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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Chandan3
New Member

Formatting numbers in a visual based on its value

Hi everyone,

 

I'm using Treemap visual with two levels of data. For a clean report, I want to round the numbers.

 

In Indian number system, 100,000 (hundred thousand) in international number system is 1,00,000 (one lakh) and 1,000,000 (one million) is 10,00,000 (ten lakh). PowerBI supports the format natively, except in the format section of the visual, the display units are "Thousands", "Millions", etc.

The display unit "Auto" is the correct function I need, but the number system is different. I tried to find a workaround for this without success.

 

Unlike in spreadsheets, I found that PowerBI does not allow conditions while formatting, like "if amount is bigger than X, apply this format, otherwise apply that format". Measures only show one value, so can't use it inside a visual for this purpose.

 

Is it possible to format numbers in a visual based on its value? 12,56,524 becomes 12.56 L, but 12,524 becomes 12.52 K?   [L = Lakhs]

 

If that is not possible, is it possible to format the numbers in a visual to the nearest hundred? 12,56,524 becomes 12,56,500, and 12,524 becomes 12,500?

The numbers itself should not be rounded, it should only be presented as rounded. Because the treemap has multiple levels of data, rounding can change the totals significantly.

 

Have you faced a similar problem? Do you know if this is solvable, and if it is can you point me in the right direction?

 

Thank you for your time and have a good day!

Chandan

1 ACCEPTED SOLUTION

When I answered this I found what I was looking for. I just had to remove the text and add the measure instead.

 

Amount = VAR YourValue = SUM('Tablename'[Value])
RETURN
SWITCH(TRUE(),
YourValue >=100000, ROUND(YourValue,-3),
ROUND(YourValue,-2)
)

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Chandan3 ,

 

You can do it with DAX.

 

Create the following measures:

Measure = 
VAR YourValue = SUM('Table'[Num])
RETURN
SWITCH(TRUE(),
YourValue >=10000000, FORMAT(YourValue,"##\,##\,##\,##0"),
YourValue >=100000, FORMAT(YourValue,"##\,##\,##0"),
FORMAT(YourValue,"##,##0")
)
Measure 2 = 
VAR YourValue = SUM('Table'[Num2])
RETURN
SWITCH(TRUE(),
YourValue >=100000, ROUNDDOWN(DIVIDE(YourValue,100000),2)&"L",
ROUNDDOWN(DIVIDE(YourValue,1000),2)&"K")

3.png

 

Best Regards,

Stephen Tao

 

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

 

I want the numbers within the visual to follow this formatting. Is there some way to use measures within a visual?  I don't think is possible because measure with text added is text and not a number.

When I answered this I found what I was looking for. I just had to remove the text and add the measure instead.

 

Amount = VAR YourValue = SUM('Tablename'[Value])
RETURN
SWITCH(TRUE(),
YourValue >=100000, ROUND(YourValue,-3),
ROUND(YourValue,-2)
)

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.