Forum Discussion
Change the quarter months
- Anonymous2 years ago
Hi Pklu,
You can add a new column to raw table to get the new quarter value. Then you can use date field year level, new quarter, date field month level to create a hierarchy slicer to achieve your requirement.
Fiscal Quarter = VAR offset = 3 VAR newQuarter = QUARTER ( DATE ( YEAR ( Table1[StartDate] ), MONTH ( Table1[StartDate] ) + offset, DAY ( Table1[StartDate] ) ) ) RETURN "Q" & newQuarter
Regards,Xiaoxin Sheng
Pklu you can create a DAX measure that maps the quarters to the corresponding months. Here is an example of how you can do this:
Quarter to Month = SWITCH(Event Dates[Quarter],
"Q1", "October, November, December",
"Q2", "January, February, March",
"Q3", "April, May, June",
"Q4", "July, August, September",
BLANK()
)This measure uses the SWITCH function to map each quarter to the corresponding months. If the quarter is not one of the specified values, the measure returns a blank value.
Note:
- Pklu2 years agoFrequent Visitor
Hello DallasBaba
This is the error I am getting. It says the table not found but it is there. here is the screen shot for you to see.
The date name is start date.
And also the error messaage.
Thanks
- Anonymous2 years agoNot applicable
HI Pklu,
Table columns cannot directly be invoked in measure expression, I'd like to suggest you use aggregation functions to get the current value at first and stored in the variable. Then you can use this variable value to compare with conditions.
Quarter to Month = VAR currQuarter = SELECTEDVALUE ( 'Event Dates'[Quarter] ) RETURN SWITCH ( currQuarter, "Q1", "October, November, December", "Q2", "January, February, March", "Q3", "April, May, June", "Q4", "July, August, September", BLANK () )Regards.
Xiaoxin Sheng
- Pklu2 years agoFrequent Visitor
Hello Sheng, Anonymous
Tthank you so much for your code. The code worked but I had to change it to the following to get it to work properly.
Quarter to Month =VAR currQuarter = SELECTEDVALUE ( 'Events Information'[Start Date].[Quarter] )RETURN SWITCH( currQuarter, "Q1", "October, November, December", "Q2", "January, February, March", "Q3", "April, May, June", "Q4", "July, August, September", BLANK () )The field is called Start Date.The Start Date field has the following data:01/23/202304/25/202305/12/202306/13/202307/19/202308/15/202309/27/202311/02/202311/29/202312/17/202312/27/2023The question is how do I add the new measure to the slicer? I tried to add it to the slicer but it would not show up in the field area. I tried dragging it also but it would not add it. Or how do I reference it so it shows up in the slicer so they can pick the different Qtrs.Thanks.