Forum Discussion
Cogidubnus_Rex
6 years agoFrequent Visitor
Sort by two columns in DAX
I've spent hours with one of my Power BI consultants trying to do in DAX what is a two-second operation in Query Editor, but unfortunately this isn't quite happening! All we want to do is to sort...
- 6 years ago
In Edit queries,
Add conditional column
sort the "status rank" column first, then sort the "value" column, add an index column,
Close &&apply, create columns
clc invoice = CALCULATE(SUM('Table'[Invoice]),FILTER('Table','Table'[Index]<=EARLIER('Table'[Index]))) on time = IF([Due status]="Past due",0,1) clc on time invo = IF([on time]=0,0,CALCULATE(SUM('Table'[Invoice]),FILTER('Table','Table'[Index]<=EARLIER('Table'[Index])&&[on time]=1))) clc on time% = [clc on time invo]/[clc invoice]Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-juanli-msft
Community Support
6 years agoIn Edit queries,
Add conditional column
sort the "status rank" column first, then sort the "value" column, add an index column,
Close &&apply, create columns
clc invoice = CALCULATE(SUM('Table'[Invoice]),FILTER('Table','Table'[Index]<=EARLIER('Table'[Index])))
on time = IF([Due status]="Past due",0,1)
clc on time invo = IF([on time]=0,0,CALCULATE(SUM('Table'[Invoice]),FILTER('Table','Table'[Index]<=EARLIER('Table'[Index])&&[on time]=1)))
clc on time% = [clc on time invo]/[clc invoice]
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cogidubnus_Rex
6 years agoFrequent Visitor
Maggie, thank you so much for your solution, it's beautiful. I think I've fallen in love...