Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more
hey all,
So I'm running into a issue with creating a simple measure that has dynamic units ( thousands (k) up to billions (B))
I'm using the switch function, but it doesn't seem to be working.
VAR Amt = [raw Payment Amount]
RETURN
SWITCH(
TRUE(),
Amt >= 1000000000, FORMAT(Amt / 1000000000, "$#,##0.0") & "B",
Amt >= 1000000, FORMAT(Amt / 1000000, "$#,##0.0") & "M",
Amt >= 1000, FORMAT(Amt / 1000, "$#,##0.0") & "K",
FORMAT(Amt, "$#,##0.0")
I created a test measure, and every time it gives me "Less than Thousand"... even when the raw displays more... so it's something about Amt not being seen as a value?....but if i do a simple Amt / 1000...that works fine.
TestDivision =
VAR Amt = [raw Payment Amount]
RETURN
SWITCH(
TRUE,
Amt > 1000000000, "Billion",
Amt >= 1000000, "Million",
Amt > 100, "Thousand",
ISBLANK(Amt),"",
"Less than Thousand"
I'm a little stumped, if anyone has any suggestions, that would be appreciated (sorry I can't share the .pbix!)
Solved! Go to Solution.
Hi! Try this:
I have my base measure [Total], then I made this measure to switch how it would display:
DynamicDisplayUnits =
SWITCH(
TRUE(),
[Total] >= 1000000000, FORMAT([Total] / 1000000000, "0.0B"),
[Total] >= 1000000, FORMAT([Total] / 1000000, "0.0M"),
[Total] >= 1000, FORMAT([Total] / 1000, "0.0K"),
FORMAT([Total], "0")
)
Proud to be a Super User! | |
Omg...my brain is apparently done for the day...it was negative amount, therefore of course my measure wasn't working... thanks for the help @audreygerred
My pleasure! Happy to help!
Proud to be a Super User! | |
Hi! Try this:
I have my base measure [Total], then I made this measure to switch how it would display:
DynamicDisplayUnits =
SWITCH(
TRUE(),
[Total] >= 1000000000, FORMAT([Total] / 1000000000, "0.0B"),
[Total] >= 1000000, FORMAT([Total] / 1000000, "0.0M"),
[Total] >= 1000, FORMAT([Total] / 1000, "0.0K"),
FORMAT([Total], "0")
)
Proud to be a Super User! | |
Check out the April 2025 Power BI update to learn about new features.
Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
User | Count |
---|---|
98 | |
61 | |
47 | |
36 | |
34 |