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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Khang
Frequent Visitor

Display % in a Matrix visual that has decimal number formatting - within multiple filtered contexts

Hello DAXperts,

 

I have a matrix visual showing my data from a "MainData" table.
I have been able to display % numbers for selected rows while the rest of the matrix is decimal formatted. But this only works within certain filtered contexts based on the selected slicers.

 

Ultimately, I have a Profit & Loss report, I want this report to show the correct calculated % values for the "Gross Profit %" row.

Currently, the data does contain the correct decimal values for the % equivalent number for "Gross Profit %". But the numbers are correct when only a single Business Unit is selected on the slicer.

 

Ideally, the GP% can be calculated by use of a measure or something similar (but I have not gone this route):

    GP% = DIVIDE( CALCULATE( [PL], 'MainData'[L1] = "Gross Profit", CALCULATE( [PL], 'MainData'[L1] = "Revenue" ) )


The measure I really need help with is [ActualsPL w %] or [ComparisonPL w %].

See below image and attached PBIX file.
Any suggestions or workarounds is much appreciated!

Capture.PNG

 

 

1 ACCEPTED SOLUTION
v-kkf-msft
Community Support
Community Support

Hi @Khang ,

 

Please modify the measure [ShowPL].

 

 

ShowPL = 
IF( SELECTEDVALUE(Tbl_Glb_Show[Show]) = "YTD", 

    IF( SELECTEDVALUE( MainData[L1] ) = "Gross Profit %",
        CALCULATE( [PL YTD], MainData[L1] = "Gross Profit" && MainData[Figures] = "Actuals") / CALCULATE( [PL YTD], MainData[L1] = "Revenue" && MainData[Figures] = "Actuals"),
        CALCULATE( [PL YTD], MainData[Figures] = "Actuals")),

    IF( SELECTEDVALUE( MainData[L1] ) = "Gross Profit %",
        CALCULATE( [PL], MainData[L1] = "Gross Profit" && MainData[Figures] = "Actuals", ALLSELECTED(MainData)) / CALCULATE( [PL], MainData[L1] = "Revenue" && MainData[Figures] = "Actuals", ALLSELECTED(MainData)),
        CALCULATE( [PL], MainData[Figures] = "Actuals"))
        )

 

vkkfmsft_0-1652677454270.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-kkf-msft
Community Support
Community Support

Hi @Khang ,

 

Please modify the measure [ShowPL].

 

 

ShowPL = 
IF( SELECTEDVALUE(Tbl_Glb_Show[Show]) = "YTD", 

    IF( SELECTEDVALUE( MainData[L1] ) = "Gross Profit %",
        CALCULATE( [PL YTD], MainData[L1] = "Gross Profit" && MainData[Figures] = "Actuals") / CALCULATE( [PL YTD], MainData[L1] = "Revenue" && MainData[Figures] = "Actuals"),
        CALCULATE( [PL YTD], MainData[Figures] = "Actuals")),

    IF( SELECTEDVALUE( MainData[L1] ) = "Gross Profit %",
        CALCULATE( [PL], MainData[L1] = "Gross Profit" && MainData[Figures] = "Actuals", ALLSELECTED(MainData)) / CALCULATE( [PL], MainData[L1] = "Revenue" && MainData[Figures] = "Actuals", ALLSELECTED(MainData)),
        CALCULATE( [PL], MainData[Figures] = "Actuals"))
        )

 

vkkfmsft_0-1652677454270.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Winniz,
This worked perfectly.
Thanks so much!

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors