Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi,
how to write the measure of IF function?
i succeeded just calculate column.
i wont to use a measure instead of calculate column
This calculate column work
sum_if_true2 = IF((sh[asmbly])=TRUE(),[total sale],0)
This dax doesn't work
sum_if_true = IF(VALUES(sh[asmbly])=TRUE(),[total sale],0)
Thanks
Solved! Go to Solution.
Hi @yoav20007,
You can try below formula, I use 'lastnonblank' function to get current row contents:
sum_if_true2 =
VAR _current =
LASTNONBLANK ( sh[asmbly], [asmbly] )
RETURN
IF ( _current, [total sale], 0 )
Reference link:
Regards,
Xiaoxin Sheng
Hi,
Try this
=CALCULATE(SUM(sh[sales]),FILTER(sh,sh[asmbly]=TRUE()))
Hope this helps.
Hi @yoav20007,
You can try below formula, I use 'lastnonblank' function to get current row contents:
sum_if_true2 =
VAR _current =
LASTNONBLANK ( sh[asmbly], [asmbly] )
RETURN
IF ( _current, [total sale], 0 )
Reference link:
Regards,
Xiaoxin Sheng
Thank you @Anonymous
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 57 | |
| 44 | |
| 40 | |
| 21 | |
| 18 |