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! Request now

Reply
Jon3sy
Helper I
Helper I

CONVERT SQL SYNTAX TO EQUIVALENT DAX

I am wondering how to convert this specific sql syntax to an "equivalent" DAX syntax if it is possible? Thanks in advance.

Customer Level CPI =
(CASE WHEN SUM(CASE WHEN ISNULL(amount_sell,0)>0
THEN 1
ELSE 0
END) > 0 THEN
ROUND (SUM(CASE WHEN ISNULL(amount_sell,0)>0
THEN CONVERT(NUMERIC(10,2),((ISNULL(initial_budget,0) + ISNULL(approved_changes,0)) * (ISNULL(progress_pct,0) / 100)) / amount_sell)
ELSE 0
END)/SUM(CASE WHEN ISNUL(amount_sell,0)>0
THEN 1
ELSE 0
END),2) ELSE 0 END) as CPI

1 ACCEPTED SOLUTION
some_bih
Super User
Super User

Hi @Jon3sy  using AI proposed solution is as following:

Did I answer your question? Mark my post as a solution! Kudos Appreciated!

Customer Level CPI =
IF (
SUMX (
FILTER (
YourTableName,
NOT ISBLANK ( [amount_sell] ) && [amount_sell] > 0
),
1
) > 0,
ROUND (
SUMX (
FILTER (
YourTableName,
NOT ISBLANK ( [amount_sell] ) && [amount_sell] > 0
),
(
( [initial_budget] + [approved_changes] )
* [progress_pct] / 100
) / [amount_sell]
)
/ SUMX (
FILTER (
YourTableName,
NOT ISBLANK ( [amount_sell] ) && [amount_sell] > 0
),
1
),
2
),
0
)





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






View solution in original post

2 REPLIES 2
some_bih
Super User
Super User

Hi @Jon3sy  using AI proposed solution is as following:

Did I answer your question? Mark my post as a solution! Kudos Appreciated!

Customer Level CPI =
IF (
SUMX (
FILTER (
YourTableName,
NOT ISBLANK ( [amount_sell] ) && [amount_sell] > 0
),
1
) > 0,
ROUND (
SUMX (
FILTER (
YourTableName,
NOT ISBLANK ( [amount_sell] ) && [amount_sell] > 0
),
(
( [initial_budget] + [approved_changes] )
* [progress_pct] / 100
) / [amount_sell]
)
/ SUMX (
FILTER (
YourTableName,
NOT ISBLANK ( [amount_sell] ) && [amount_sell] > 0
),
1
),
2
),
0
)





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






You're a legend - worked perfect. Immense thanks

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.