In cell A1 we have this:
=CUBEMEMBER("OurCube","TAIL([Date].[Date - Calendar Month].[Calendar Day].MEMBERS,1).item(0)","TargetMember")
It works fine and returns a single member that is yesterday.
In A2 we have a formula that is attempting to return the actual date - so I thought the CUBEMEMBERPROPERTY function would work:
=CUBEMEMBERPROPERTY("OurCube",A1,"member_caption")
The above returns #N/A
I don't know what CUBEMEMBERPRPERTY does but apparently it doesn't mean what you think it means!
If you need to get a certain property of a field according to another field, this is the way to do it:
Let's say, I wanted the Financial Year's month name (FY Month Name) based on a certain date key (I live in Australia, the financial year finishes at June):
=CUBEMEMBER("ThisWorkbookDataModel", "EXISTS([Dim Period].[FY Month Name].Children, [Dim Period].[Datekey].[20160731])")
And if the value of "20160731" has been in a certain cell, it would go like this:
=CUBEMEMBER("ThisWorkbookDataModel", "EXISTS([Dim Period].[FY Month Name].Children, [Dim Period].[Datekey].["&A8&"])")
Both would give me the correct answer: 01 - July
And I would like to thank the following posts for their help:
https://wessexbi.wordpress.com/2014/02/16/a-cubememberproperty-equivalent-with-powerpivot/
http://www.mrexcel.com/forum/power-bi/730287-function-cubememberproperty-always-return-n.html
Related
I have a table that has a series of Columns with data I need to split out. Example below
STATUS#10/16 12:00:00 (CODE)
I've been able to split it easy enough and when I originally tried to set the date on an older dataset it identified it as a date e.g. 16th Oct 2021 However I started to get errors on this date column and trying with different datasets (10/12, 10/13, 10/14) it is not finding the date. I tried the following query code but I'm receiving errors
[STATUS DATE] is split to 10/14, 10/15 etc
#date( Date.Year(DateTime.LocalNow), Date.Month(Text.End([STATUS DATE]), 2), Date.Day(Text.Start([STATUS DATE]),2))
However I'm getting a function error so I tried
Date.From(Date.Day(Text.Start([STATUS DATE]),2) & Date.Month(Text.End([STATUS DATE]),2) & Date.Year(DateTime.LocalNow)
I have also tried to do this from an example column however the query created is looking at the cell value e.g. if 10/14 then 14/10/2021 else if 13/10 then 14/10/2021. This method i feel is prone for error once I include a larger dataset.
Is there anyway I can determine the date value based on mm/dd format? But with year end in mind, make the YYYY be determined by current year unless we move into Jan and then I don't want the Oct, Nov, Dec value showing as 2022.
You don't really show what your original data looks like.
But if it is like:
Source
Then you can use this code in the Add Custom Column dialog:
let
split=Text.SplitAny([STATUS DATE],"#/ "),
mnth = Number.From(split{1}),
dy = Number.From(split{2})
in
#date(Date.Year(DateTime.LocalNow()),mnth,dy)
The Text.SplitAny function lets you input a list of delimiters and the text will split on all of them. So it is relatively simple to extract the month and day values
to create:
Split [STATUS DATE] one more time into [Month] and [Day] column, using the "/" as a separator. Then you don't have to bother with 1 or 2 digit numbers and you can simply use this formula:
#date(Date.Year(DateTime.LocalNow()), [Month], [Day])
DateTime.LocalNow() is a function, so you need to add the brackets.
[Month] and [Day] are numbers already, so you don't need the Date.Month() or Date.Day() functions.
I'm on my research project to find the last price for a security at IPO and 20 trading days after for 5 years. I use =BDP($A$1, "EQY_INIT_PO_DT") to get the IPO trading date and its fine. The issue happened when I use =BADDPERIODS(A2, "NumberOfPeriods", "20", "CDR", "ID JA", "BusDayAdj", "1") it still include the non trading days. So when I use =BDH($A$1, "PX_LAST", A6, A6) it shows #N/A N/A. I guess =baddperiods() function outputted the non trading days and the =bdh() unable to get the price. How can I obtain the correct 20 trading days (exclude weekends and any public / non-trading days) after a certain date?
Reference:
A1= Company Ticker
A2= IPO Date
A3= =BADDPERIODS(A2, "NumberOfPeriods", "20", "CDR", "ID JA", "BusDayAdj", "1")
...
A6= =BADDPERIODS(A5, "NumberOfPeriods", "20", "CDR", "ID JA", "BusDayAdj", "1")
The BDH() worksheet function has optional parameters that specify how the timeseries data is returned. These come after the start and end date parameters. One of these allows a calendar to be specified. Specifying a calendar prompts Bloomberg to look back and find the closest (but earlier) 'good' value for the date requested.
The short, but inefficient answer is to use this formula in cell B6:
=BDH($A$1,"PX_LAST",A6,A6,"CDR","JA")
It is inefficient because each cell is making a relatively expensive call to Bloomberg for one day's history. It is better to pull back all the history from the start date to today in a single call, and put it in some spare columns. Then look your date up (using INDEX/MATCH) to find the price value.
I have a table containing several columns of which one is a date/time field. I am trying to get a count of instances per day using the following
=COUNTIFS(Table4[Data],"Apple",Table4[Date],(CONCATENATE(V4,"*")))
Data Date Comp Date Count
Apple 6/12/18 1:00 PM 6/12/18 12:00 AM 0
Apple 6/12/18 7:00 AM
Orange 6/12/18 1:30 PM
Apple 6/11/18 11:23 AM
From my understanding of all the moving parts here I should be checking to see if "Apple" exists in the data column and then if "6/12/18" with any amount or type of characters after it exists. If both are true I will then get a count + 1 leaving me with a value of 2 in the above example.
What I actually get however is a 0 unless I match the time portion of date the data to be exactly the same and then removed the wildcard ,"*" from the equation.
Am I doing something wrong or can the wildcard not be used to accomplish what I am trying?
Thanks!
I think you should set your criteria properly.
If you add an additional column next to your Date that contains calculates the integer value of your date using INT() and format the display as DATE (m/d/yyyy) you should then be able to use the following COUNTIFS formula
=COUNTIFS(Table4[Data], "Apple", Table4[Date], "=6/12/18")
See the explanatory video from their Office' support site: https://support.office.com/en-us/article/countifs-function-dda3dc6e-f74e-4aee-88bc-aa8c2a866842
If your [Date] column is a datetime or smalldatetime, you can work with it using CONVERT function, depending on how you want to group.
For example, if you don't care about the time to do the group, you could use the next query:
SELECT CONVERT(varchar,[Date],103), [Data], COUNT(*)
FROM [test_delete].[dbo].[Table1]
GROUP BY CONVERT(varchar,[Date],103), [Data]
This should result in something like this:
[Date] [Data] [Count]
11/06/2018 Apple 1
12/06/2018 Apple 2
12/06/2018 Orange 1
Hope this helps you
If your dates are stored as dates instead of text, use the following:
=COUNTIFS(Table4[Data],"Apple",Table4[Date],">="&V4,Table4[Date],"<"&V4+1)
I am looking to return the date (deadline) into a cell sheet which is not on a Sat and/or Sun. So for example, if the starting date is Monday 04/09/2017 and we need 6 days to complete the work, I want the deadline to says Monday 11/09/2017.
The response from User91504 will solve your issue, I will just add to use something like this in your case
=WORKDAY(J13,6)-1
As the formula is taking the current day into account as part of the leadtime, otherwise it will provide 12/09/2017 as result
=WORKDAY(your start date , number of days to add)
If your date was in Cell J13, then:
=WORKDAY(J13,6)
Or if you manually type the date, use DATE function:
=WORKDAY(DATE(2017,9,4),6)
I have a set of data as such:
05/06/2015
04/06/2015
03/06/2015
02/06/2015
29/05/2015
28/05/2015
27/05/2015
26/05/2015
25/05/2015
22/05/2015
21/05/2015
20/05/2015
19/05/2015
18/05/2015
15/05/2015
14/05/2015
13/05/2015
12/05/2015
11/05/2015
08/05/2015
07/05/2015
06/05/2015
05/05/2015
04/05/2015
30/04/2015
29/04/2015
28/04/2015
27/04/2015
24/04/2015
23/04/2015
22/04/2015
21/04/2015
20/04/2015
17/04/2015
16/04/2015
15/04/2015
14/04/2015
13/04/2015
10/04/2015
09/04/2015
08/04/2015
07/04/2015
06/04/2015
02/04/2015
01/04/2015
31/03/2015
These refer to the weekdays in a year. Among these dates, I want to find the first date of the month. So for example, the month of June, the first date to be identified should be 02/06/2015 and for May be 04/05/2015.
I have tried something like this:
=IF(Cellreference=((Cellreference)-DAY(Cellreference)+1),TEXT(Cellreference,"mmm"),"")
But this only takes the first date of the month. I want it to be the first date in the month in the list of dates given.
Need some guidance on how to achieve this.
I see you use Formula so I can only suggest below:
=MIN(IF(MONTH(AllDateReference)=MONTH(CellReference),AllDateReference,1E+99))
This is an array formula entered using Ctrl+Shift+Enter.
Actual sample:
=MIN(IF(MONTH(A$1:A$46)=MONTH(A1),A$1:A$46,1E+99))
where A$1:A$46 contains all your dates.
Edit1: Display on first date of the month only.
=IF(A1=MIN(IF(MONTH(A$1:A$46)=MONTH(A1),A$1:A$46,1E+99)),A1,"")
Sample: