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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Conditional decimals

Hi, I have a Measure and it's calculating correctly, Initially I've a requirement from user to always display only one Decimal UP on a Matrix Visual. so I've used ROUNDUP([SalesAvg],1).

But the isue is in the Matrix Visual, when I drilldown there are so many scnearios value is like 0.001, 0.04, 0.07 and because Decimal as 1 in the Modeling tab, it is defaulting to 0.1 (UP) always.

 

But in these scenarios User wants to display 2 decimals instead of 1.

 

Is there a way to define number of decimals conditionally like something below.

 

IF( [SalesAvg] < 0.1, ROUNDUP([SalesAvg], 2)
                             , ROUNDUP([SalesAvg], 1 ) )

then I selected Format--> General, Decimals--> AUTO (if I select Format as 'Decimal Number' there is no AUTO option.)

But this statement is always displaying 2 decimals.

 

Thank you!

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Anonymous ,

 

Don't know what is the upper level of the matrix but you should place a measure similar to the one below replacing the Column name with the lowest level:

Measure =
IF (
    HASONEFILTER ( 'Table'[cat2] );
    FORMAT ( ROUNDUP ( [SalesAvg]; 2 ); "0.00" );
    FORMAT ( ROUNDUP ( [SalesAvg]; 1 ); "0.0" )
)

This will make the 2 decimal and format with the number of decimal places you need.

 

Regards,

MFelix


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

1 REPLY 1
MFelix
Super User
Super User

Hi @Anonymous ,

 

Don't know what is the upper level of the matrix but you should place a measure similar to the one below replacing the Column name with the lowest level:

Measure =
IF (
    HASONEFILTER ( 'Table'[cat2] );
    FORMAT ( ROUNDUP ( [SalesAvg]; 2 ); "0.00" );
    FORMAT ( ROUNDUP ( [SalesAvg]; 1 ); "0.0" )
)

This will make the 2 decimal and format with the number of decimal places you need.

 

Regards,

MFelix


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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