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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It 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
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

Top Solution Authors