Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
HI
This may just seem like a simple solution, I maybe am over complicating matters here, but what I think makes sense DAX just disagrees or does the opposite to what I want. I am a litte lost.
This is my forumla in DAX, I am trying to create a Date table, which will evetually will be populated with our Fiscal Periods and Quarters. I thought if I could first get the key Date column right then the rest would just fall into place; thats the theory.
My Formula:
Solved! Go to Solution.
Looks good. You can simplify the switch statements to either
SWITCH (TRUE(),[MonthNumber] in {11,12,1},"Q2"
,[MonthNumber] in {2,3,4},"Q3"
,[MonthNumber] in {5,6,7},"Q4"
,[MonthNumber] in {8,9,10},"Q1"
,blank() )
or
SWITCH ([MonthNumber],1,"Q2",2,"Q3",3,"Q3",4,"Q3",5,"Q4",6,"Q4",
7,"Q4",8,"Q1",9,"Q1",10,"Q1",11,"Q2",12,"Q2",blank() )
That's a rather inventive use of CALENDARAUTO. Have you considered using CALENDAR() and then just adding your own Fiscal Year logic? Or even better, use an external Dates table.
Hi
I have a datasource; what I mean by a datasource is I have a table with many columns which cover various periods/ranges but I am only interested in two columns, which is my key or main focus was to try and use the FiscalYearEndMonth part along with some filtering.
When use the CALENDARAUTO in its own I get years in the range from 1979 to 2056, when I am only needing to look at say 2010 to 2020. Its picking up another set of dates that are not needed for this purpose or not needed for working out the Fiancial Years if that makes sense.
I thought adding some additional filtering to the forumla would offer some flexability to the range I wanted to use.
Chris
You're better off supplying your own dates table where you can control the range and the fiscal logic.
H
Understand, I take it you mean alogn these lines -
Either that (and ADDCOLUMNS()) , or a totally external table that comes from SQL server, Excel, or even a CSV.
Looks good. You can simplify the switch statements to either
SWITCH (TRUE(),[MonthNumber] in {11,12,1},"Q2"
,[MonthNumber] in {2,3,4},"Q3"
,[MonthNumber] in {5,6,7},"Q4"
,[MonthNumber] in {8,9,10},"Q1"
,blank() )
or
SWITCH ([MonthNumber],1,"Q2",2,"Q3",3,"Q3",4,"Q3",5,"Q4",6,"Q4",
7,"Q4",8,"Q1",9,"Q1",10,"Q1",11,"Q2",12,"Q2",blank() )
Ibendin
Thats great, will give that a trial also.
Thanks again.
Chris
If you are ok to continue with this topic, I have updated my model from your last reply, or would you prefer this discussion is now closed?
So I took on board what you said about ADDCOLUMNS, I don't have the option of a date table from SQL or excel so I would be creating a version in my model. Below is what I have compiled, I will admit I have taken a few snippites from various sources, some examples out there are just too in depth and I would not fully understand what I was using. Hopefully what I am doing here is still considered to be good practice -
So I applied just some small amounts of DAX to get the results in my 'dimDate' table (shown below as a screen print).
Dax:
User | Count |
---|---|
25 | |
12 | |
8 | |
8 | |
7 |
User | Count |
---|---|
27 | |
13 | |
13 | |
11 | |
6 |