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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
ajit_singh
Frequent Visitor

Using calculation group to selectively replace measures "as well as replace measure format"

Using calculation group, measures can be selectively replaced in a placeholder measure as explained in the article:

https://www.sqlbi.com/articles/using-calculation-groups-to-selectively-replace-measures-in-dax-expre...

The requirement is not only to selectively replace the measure but replace the measure format as well.

The placeholder measure's format needs to be changed as per the measure being substituted e.g. decimal, whole, percentage etc.

 

The example taken for this requirement is bit contrived but the same solution can be applied to some other real world valid examples.

 

Steps:

1. Download the pbix file from https://www.sqlbi.com/articles/using-calculation-groups-to-selectively-replace-measures-in-dax-expre...

2. In report "F02", when PriceToUse = "Net Price", show the "Margin %" column with 3 decimals as below:

 

Image 001.png

3. In report "F02", when PriceToUse = "Unit Price", show the "Margin %" column with 2 decimals as below:

Image 002.png

 Thanks.

 

 

1 ACCEPTED SOLUTION
ajit_singh
Frequent Visitor

I think the requirement can not be implemented.

The reason being "Format String Expressions" option is not available to regular measures, only available to calculation items.

Here [Margin %] being a regular measure, only static "format string" can be applied, not dynamically based on the calculation item selection using "Format String Expressions".

It would be a good feature addition, being able to apply dynamic formatting to regular measures using "Format String Expressions".

Image 8.png

View solution in original post

1 REPLY 1
ajit_singh
Frequent Visitor

I think the requirement can not be implemented.

The reason being "Format String Expressions" option is not available to regular measures, only available to calculation items.

Here [Margin %] being a regular measure, only static "format string" can be applied, not dynamically based on the calculation item selection using "Format String Expressions".

It would be a good feature addition, being able to apply dynamic formatting to regular measures using "Format String Expressions".

Image 8.png

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Top Kudoed Authors