Forum Discussion
afbraga66
5 years agoHelper III
Sort Matrix by dynamic column value based on filters
Hi, I have a requirement to sort a matrix by the last possible month value, 7 in the example below. The issue is that Power BI only sorts by the total and that is not what I want. I ...
Greg_Deckler
5 years agoCommunity Champion
afbraga66 So like this?:
Today Month =
VAR __Date = MAX('DOWNTIME'[DIA_FABRIL])
RETURN
CALCULATE([mDuration(min)], KEEPFILTERS(DOWNTIME[MES_FABRIL]=MONTH(__Date)))
Updated PBIX attached below sig.
afbraga66
5 years agoHelper III
Hello Greg,
Thank you so much for your help.
I tried your formula, but I have a issue with it. It's the fact that when the value is null it assumes in the total the latest value for the given months(148,05 from month 6). But in this case I need the 81 to be before the null in the sorting. Is there another way?
Best regards,
André
- Greg_Deckler5 years agoCommunity Champion
afbraga66 Perhaps:
Today Month = VAR __Date = MAX('DOWNTIME'[DIA_FABRIL]) RETURN IF(ISBLANK([mDuration (min)], BLANK(), CALCULATE([mDuration(min)], KEEPFILTERS(DOWNTIME[MES_FABRIL]=MONTH(__Date))) )- afbraga665 years agoHelper III
Hey Greg_Deckler ,
I have tried it, but it is not working. Still giving the same result as the previous one unfortunately.
Probably because the ISBLANK() evaluates against the values of all months in that expression?
Thank you.
- Greg_Deckler5 years agoCommunity Champion
afbraga66 What about this version?
Today Month = VAR __Date = MAX('DOWNTIME'[DIA_FABRIL]) VAR __mDuration = CALCULATE([mDuration(min)],KEEPFILTERS(DOWNTIME[MES_FABRIL]=MONTH(__Date))) RETURN IF(ISBLANK(__mDuration), BLANK(), __mDuration )