Forum Discussion
Descending Order for Date in Matrix
- 4 years ago
Hi jcastr02 ,
Adjust to the below and sort by rank2:
RANK = var q1=FORMAT('Table'[Date],"YYYYMM") var q2=FORMAT(TODAY(),"YYYYMM") var value1=q1-q2 return value1rank2 = var q1=FORMAT('Table'[Date],"YYYYMM") var q2=FORMAT(TODAY(),"YYYYMM") return if(q1-q2<0,ABS(q1-q2)+MAXX('Table','Table'[RANK]),q1-q2)Or rank 2 use the below :
rank2 = var q1=FORMAT('Table'[Date],"YYYYMM") var q2=FORMAT(TODAY(),"YYYYMM") return if(q1-q2<0,MAXX('Table','Table'[RANK])+ABS(MINX('Table','Table'[RANK]))+(q1-q2),q1-q2)Output:
Did I answer your question? Mark my post as a solution!
Best RegardsLucien
Hi jcastr02 ,
Before:
After:
Test the below :
Base on table ,create a new column:
RANK = IF(FORMAT('Table'[Date],"mmmm")=FORMAT(TODAY(),"MMMM"),1,2)
Then sort month by rank:
Final create visual :
You could download my pbix file to learn more details.
Did I answer your question? Mark my post as a solution!
Best Regards
Lucien
- jcastr024 years ago
Post Prodigy
Hi v-luwang-msft Thanks for your help. I looked on your Power BI, the most recent month comes forward, which is great, but then the rest of the months are not sequential. See screen shot below from your BI.
- v-luwang-msft4 years ago
Community Support
Hi jcastr02 ,
Adjust to the below and sort by rank2:
RANK = var q1=FORMAT('Table'[Date],"YYYYMM") var q2=FORMAT(TODAY(),"YYYYMM") var value1=q1-q2 return value1rank2 = var q1=FORMAT('Table'[Date],"YYYYMM") var q2=FORMAT(TODAY(),"YYYYMM") return if(q1-q2<0,ABS(q1-q2)+MAXX('Table','Table'[RANK]),q1-q2)Or rank 2 use the below :
rank2 = var q1=FORMAT('Table'[Date],"YYYYMM") var q2=FORMAT(TODAY(),"YYYYMM") return if(q1-q2<0,MAXX('Table','Table'[RANK])+ABS(MINX('Table','Table'[RANK]))+(q1-q2),q1-q2)Output:
Did I answer your question? Mark my post as a solution!
Best RegardsLucien
- bondonian2 years agoFrequent Visitor
This isnt working for me because of the circular dependancy; referencing the Date column in the calculated column which you are then going to tell Date to sort by. how did you get around that?