Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello, I am new to PowerBI and learning. I created calculated measures for Product Revenue TY and PR LY, with one more for YoY PR. In my YoY PR column, I have a bunch of -100% because there are some new products in the table this year. I'm wondering how I can simply replace the -100%'s with "New" to make it look cleaner. I know in sql you can use a case when statement to replace the values, i'm lost on how to do it here.
Please note these are calculated measures, not tables.
Calculations:
Product Revenue This Year:
Solved! Go to Solution.
HI @ehanson2,
You can add if statement with the condition to compare with static value and return the result.
Measure =
IF([YoY PR] = -1,"New",[YoY PR]&"")
Notice: measure not support to return different type of values at the same time, if you want to use both text and numeric value, please change numeric to text first.
Regards,
Xiaoxin Sheng
Well, if you tried that, you would probably get an error about variant data types. You would need to replace with a number like 0 or BLANK:
Measure =
VAR __Variable = <code>
RETURN
IF(__Variable = -1,BLANK,__Variable)
@Greg_Deckler i'm having trouble getting this to work. what am i missing here? The RETURN part throws an "unexpected expression"
Measure =
[YoY PR] = (DIVIDE([PRTY], [PRLY], 0)-1)
RETURN
IF([YoY PR] = -1,BLANK,[YoY PR])
HI @ehanson2,
You can add if statement with the condition to compare with static value and return the result.
Measure =
IF([YoY PR] = -1,"New",[YoY PR]&"")
Notice: measure not support to return different type of values at the same time, if you want to use both text and numeric value, please change numeric to text first.
Regards,
Xiaoxin Sheng
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.