cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ejones_2525
Frequent Visitor

Issue with sorting a matrix columns

Hi everyone, 
I had a request to have totals of x months on the left side of a matrix table. like in the example below. 

ejones_2525_0-1632761617625.png

After researching, I found a method that worked with this article. https://4pbi.com/power-bi-matrix-totals-on-the-left/ Which requires creating a calculated table with distinct values of the lifetime in months.
Totalstable = UNION(
    DISTINCT(Sales[lifetimeInMonths]),
    DATATABLE("lifetimeInMonths", STRING, {{"2 months"}}
    ))

and then I have to create the following measures. 

2_months= IF(SELECTEDVALUE('Totalstable '[lifetimeInMonths]) = " 2 months", 1, 0)

SalesWithTotal = IF([2_months], CALCULATE(SUM(Sales[Sales]), 'Totalstable '[lifetimeInMonths] in {1,2}, SUM(Sales[Sales]))
This works, However, since the calculated column lifetimeInMonths is now a text field, I now have a issue with sorting it the right way.
I created a lookup table like this to help with the sort. But for whatever reason, my measure SalesWithTotal then doesn't show my improvised 2_months result anymore

ejones_2525_0-1632763099945.png


I have officially ran out of ideas. I tried some other things, and I got circular dependency errors.

I'm truly looking forward to your help. 

Best regards.

1 ACCEPTED SOLUTION
PaulDBrown
Super User
Super User

See if this helps:

Creating a Hybrid or custom matrix





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

3 REPLIES 3
ejones_2525
Frequent Visitor

@PaulDBrown, this solution worked me. Soo grateful 🙂 

PaulDBrown
Super User
Super User

See if this helps:

Creating a Hybrid or custom matrix





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

StefanoGrimaldi
Super User
Super User

ypu can create a second column and sort the table using that column as reference, them when used on the visual you will have that exact order on the table put it directly on the table column and get a blank square on top of the visual group it and there you go 😛

 





Did I answer your question? Mark my post as a solution! / Did it help? Give some Kudos!

Proud to be a Super User!




Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

November Power BI Update 768x460.png

Check it Out!

Click here to read more about the November 2021 Updates!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.