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.
Dear Community,
I’m trying to calculate the revenue difference between the current and previous year. For each category where I didn’t have revenue in the previous year, the field is blank. The DAX formula for revenue difference also presents a blank field for these categories.
Can someone help me with DAX to present number zero in the blank fields for the previous year? That way, I believe, the revenue difference will be presented as it should be.
Please see the picture below:
Thanky you a lot!
Vladimir
Solved! Go to Solution.
Hi @Vladimir_P ,
In most cases it would be expected to have blank value if data is missing or if we divide values with zero.
However, if you have business target to display these blanks as zeros, you can set it within IF statement.
Example:
if(
isblank(
CALCULATE([Sales],SAMEPERIODLASTYEAR(tblDate[Date]),date)
)
,0
,CALCULATE([Sales],SAMEPERIODLASTYEAR(tblDate[Date]),date)
)
Cheers,
Nemanja Andic
Hi @Vladimir_P ,
In most cases it would be expected to have blank value if data is missing or if we divide values with zero.
However, if you have business target to display these blanks as zeros, you can set it within IF statement.
Example:
if(
isblank(
CALCULATE([Sales],SAMEPERIODLASTYEAR(tblDate[Date]),date)
)
,0
,CALCULATE([Sales],SAMEPERIODLASTYEAR(tblDate[Date]),date)
)
Cheers,
Nemanja Andic
Hello @nandic ,
Thank you very much! It works very well in my model 🙂
The essential thing was to present data in the field "Revenue difference". Before your solution, this was not possible. Thank you for that!
Have a nice day!
Vladimir
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.
User | Count |
---|---|
47 | |
26 | |
19 | |
14 | |
10 |
User | Count |
---|---|
58 | |
50 | |
44 | |
19 | |
19 |