Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Community Champion
Community Champion

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
Community Champion
Community Champion

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.






StefanoGrimaldi
Resident Rockstar
Resident Rockstar

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.