Forum Discussion
Sort Slicer by a date descending
- 1 year ago
Anonymous
It would appear that you've omitted an extra pair of parentheses around the sub-formula.
The two snippets of code you provided should be as follows.
The Quarter number forumla:
Temp_Yr_Quart_Num = 1000000 - (YEAR(dim_date[PK_Date])*100 + QUARTER(dim_date[PK_Date]))Then, the Month number formula:
Temp_Yr_Mth_Num = 1000000 - (YEAR(dim_date[PK_Date])*100 + MONTH(dim_date[PK_Date]))
Used as the sorting coulmns for your quarter and month columns this should work.
Failing that, try creating the "Year Quarter" and "Year Month" fields as described in my previous message.
Hope that helps.
If this answers your question, please mark as a solution so others can find.
Hello PowerBIDave thanks for the tip. I did as you mentioned and getting the same error. Below I am showing what I did:
The Quarter number foruma:
Also, I sorter the month field (Year_Month) by the month number field:
At this point, my slicer with quarter - month sorts on Quarter, but not on month:
What did I miss?
Anonymous
It would appear that you've omitted an extra pair of parentheses around the sub-formula.
The two snippets of code you provided should be as follows.
The Quarter number forumla:
Temp_Yr_Quart_Num = 1000000 - (YEAR(dim_date[PK_Date])*100 + QUARTER(dim_date[PK_Date]))
Then, the Month number formula:
Temp_Yr_Mth_Num = 1000000 - (YEAR(dim_date[PK_Date])*100 + MONTH(dim_date[PK_Date]))
Used as the sorting coulmns for your quarter and month columns this should work.
Failing that, try creating the "Year Quarter" and "Year Month" fields as described in my previous message.
Hope that helps.
If this answers your question, please mark as a solution so others can find.