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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
viji_rajaraman
Frequent Visitor

sum based on calculated condition

Hi 

 

I have to convert below sql to power bi measure

 

SUM( CASE WHEN ([CRD-PF]* [OCD-PF] = 0 ) then [PO Remaining QTY] ELSE 0 END )

 

POWER BI , 

Past Due = CALCULATE(SUM (Query1[PO Remaining QTY]), Query1[OCD-PF] * Query1[CRD-PF]= 0)

getting error - The expression contains multiple columns, but only a single column can be used in a True/False expression that is used as a table filter expression. 

viji_rajaraman_1-1646731867991.png

please suggest a workaround.

 

thanks,

Viji

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@viji_rajaraman , Try like

Past Due = CALCULATE(SUM (Query1[PO Remaining QTY]),filter( Query1, (Query1[OCD-PF] * Query1[CRD-PF])= 0))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
johnt75
Super User
Super User

Past Due = SUMX( Query1, IF ( Query1[OCD-PF] * Query1[CRD-PF] = 0, Query1[PO Remaining QTY] ) )
amitchandak
Super User
Super User

@viji_rajaraman , Try like

Past Due = CALCULATE(SUM (Query1[PO Remaining QTY]),filter( Query1, (Query1[OCD-PF] * Query1[CRD-PF])= 0))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors