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

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.

Reply
Syndicate_Admin
Administrator
Administrator

Help with a measure

Hi guys, I'm a big newbie to Power BI, and I need help with a measure:

I need to subtract 2 measures, if the result it gives me is less than or equal to zero I need it to return 0, if the date is earlier than today's date I need to return zero, and if it is not fulfilled that I return the result of difference. If someone can help me, I would appreciate it.

Thanks a lot

3 REPLIES 3
Syndicate_Admin
Administrator
Administrator

Thanks for the answer but it has not worked for me gives me the following error:

Lorenz_0-1681751703892.png

Thank you

You're missing a closing bracket on line 5.

johncolley
Solution Sage
Solution Sage

Hi,

 

Subtract = 

VAR _ameasure = SELECTEDVALUE(A value)
VAR _bmeasure = SELECTEDVALUE(B value)
VAR _date = SELECTEDVALUE(date)
VAR _result = IF(_ameausre - _bmeasure <= 0, 0, IF(_date < TODAY(), 0, _ameasure - _bmeasure))

RETURN

_result

 

If this answer solves your problem please mark it as a solution!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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