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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Andres_Maldo
Frequent Visitor

Grouping measures in a matrix

Hi, Guys.

I have 4 measures (ROI, EBITDA, KPI 1, KPI 2) and I would like to classify in groups:

 

FINANCE: ROI, EBITDA

SALES: KPI 1, KPI 2

 

And I woud like to get this matrix:

Andres_Maldo_0-1655225172094.png

I appreciate any solutions.

Thanks in advance.

1 ACCEPTED SOLUTION

You can format each in the new measure. Please check the file again.




Did I answer your question? Mark my post as a solution!


https://allure-analytics.com/
https://www.youtube.com/channel/UCndD_QZVNB_JWYLEmP6KrpA
https://www.linkedin.com/company/77757292/

Proud to be a Super User!




View solution in original post

8 REPLIES 8
v-yangliu-msft
Community Support
Community Support

Hi  @Andres_Maldo ,

I created some data:

vyangliumsft_0-1655435946932.png

Here are the steps you can follow:

1. Create caluculated table.

Table 2 =
CROSSJOIN(
    VALUES('Table'[SUPERMARKET]),{"FINANCE","SALES"})

vyangliumsft_1-1655435946935.png

2. Create measure.

ROI_MEASURE = CALCULATE(SUM('Table'[Amount1]),FILTER(ALL('Table'),'Table'[SUPERMARKET]=MAX('Table'[SUPERMARKET])))
EBITDA_MEASURE = CALCULATE(SUM('Table'[Amount2]),FILTER(ALL('Table'),'Table'[SUPERMARKET]=MAX('Table'[SUPERMARKET])))
KPI1_MEASURE = CALCULATE(SUM('Table'[Amount3]),FILTER(ALL('Table'),'Table'[SUPERMARKET]=MAX('Table'[SUPERMARKET])))
KPI2_MEASURE = CALCULATE(SUM('Table'[Amount4]),FILTER(ALL('Table'),'Table'[SUPERMARKET]=MAX('Table'[SUPERMARKET])))
Measure =
SWITCH(
    TRUE(),
    MAX('Table 2'[Value])="FINANCE",CALCULATE([ROI_MEASURE],FILTER('Table','Table'[SUPERMARKET]=MAX('Table 2'[SUPERMARKET]))),
     MAX('Table 2'[Value])="SALES",CALCULATE([EBITDA_MEASURE],FILTER('Table','Table'[SUPERMARKET]=MAX('Table 2'[SUPERMARKET])))  )
Measure 2 =
SWITCH(
    TRUE(),
    MAX('Table 2'[Value])="FINANCE",CALCULATE([KPI1_MEASURE],FILTER('Table','Table'[SUPERMARKET]=MAX('Table 2'[SUPERMARKET]))),
     MAX('Table 2'[Value])="SALES",CALCULATE([KPI2_MEASURE],FILTER('Table','Table'[SUPERMARKET]=MAX('Table 2'[SUPERMARKET])))  )

3. Result:

vyangliumsft_2-1655435946938.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

ALLUREAN
Solution Sage
Solution Sage

Hi, @Andres_Maldo 

You can try this approach if fits to your data structure.

 




Did I answer your question? Mark my post as a solution!


https://allure-analytics.com/
https://www.youtube.com/channel/UCndD_QZVNB_JWYLEmP6KrpA
https://www.linkedin.com/company/77757292/

Proud to be a Super User!




Hi, ALLUREAN.

Thanks, but I have measures instead of columns. And I need to be measures. I am wondering is there is a way to group these measure in a matrix.

I use your 4 measures into one, not columns




Did I answer your question? Mark my post as a solution!


https://allure-analytics.com/
https://www.youtube.com/channel/UCndD_QZVNB_JWYLEmP6KrpA
https://www.linkedin.com/company/77757292/

Proud to be a Super User!




Thanks, I see. That´s an interesting approach, but what if I want KPI1 as a decimal number, KPI2 as a whole number and ROI as a percentaje? And I want to use conditional formatting in just one measure?

You can format each in the new measure. Please check the file again.




Did I answer your question? Mark my post as a solution!


https://allure-analytics.com/
https://www.youtube.com/channel/UCndD_QZVNB_JWYLEmP6KrpA
https://www.linkedin.com/company/77757292/

Proud to be a Super User!




Hi, @ALLUREAN.

I used a similar dax for colors, and it worked for conditional formatting.

 

Colors =
VAR Selected = SELECTEDVALUE(HeaderTable[Level2])
var x = IF(HeaderTable[ROI] > 0.10, "#A0D1FF")
var y = IF(HeaderTable[KPI1] > 30, "green", "red")
RETURN
SWITCH(TRUE(),
Selected = "ROI", x,
Selected = "KPI1", y
)

Thanks, and I would like to use different conditional formating for each measure, for example, KP1 is going to be red if it is greater than 30 and green if it is lower than 30. But ROI is going to be green if it is greater than 10% and red if is lower than 10%.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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