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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
hibarrbm
Helper I
Helper I

Transform SQL Formula Into DAX Measure For Total Sales

Hello,

 

I have a SQL formula from SQL Developer that i'm trying to translate into DAX measure formula. Its taking orders from a fact table that status key = (25,133) then from another fact table with a filter and finally if true then sum the price from the third table.

 

Here is the formula i have from SQL Developer:

 

Sum( case when ODS_OWNER.FACT_FULFILLMENT.FULFILLED_STATUS_KEY in(25,133) then (

            case when (DECODE(BITAND(ODS_OWNER.FACT_ORDER_LINE.ORDER_LINE_FLG,  POWER(2 , 0)),POWER(2 , 0), '1', '0')) = 1 then 0

else ODS_OWNER.FCT_SHIP_GRP_ITEM.FULFILLMENT_ITEM_PRICE

END) else 0 end )
 
Any help is appreciated!
1 REPLY 1
lbendlin
Super User
Super User

That is some really deep PLSQL... 

 

 

Bitand(ods_owner.fact_order_line.order_line_flg, Power(2, 0))

 

 

Isn't that just checking if  fact_order_line_flg is an odd number? You can use the MOD function for that. The equivalent for Decode seems to be COALESCE()

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.