Forum Discussion
Anonymous
6 years agoNot applicable
SQL to DAX Convert
Hello, I'm new to DAX, please help to convert below T-SQL code to its equivalnet DAX. I 'm generating running total (cummulative) using TSQL the same i need in DAX, please help selec...
- 6 years ago
Hi Anonymous ,
Modify the formula like this:
EVALUATE VAR tab = SUMMARIZE( FILTER( 'Inv_Fact_Inventory', 'Inv_Fact_Inventory'[Dashboard] = "Current Inventory" && 'Inv_Fact_Inventory'[Inventory Order Type] = "TENDERED" && 'Inv_Fact_Inventory'[Inventory Status] = "ASSIGNED" ), 'Inv_Fact_Inventory'[Received Date], "Units Assigned", CALCULATE(COUNT(Inv_Fact_Inventory[CURINV_CARGO_ID])) ) RETURN SELECTCOLUMNS( tab, "Final_Cut", var d = 'Inv_Fact_Inventory'[Received Date] return SUMX( FILTER( tab, [Received Date] <= d ), [Units Assigned] ) ) order by [Final_Cut] descYou may get your expected result, below is my sample and result:
Best Regards,
Yingjie LiIf this post helps then please consider Accept it as the solution to help the other members find it more quickly.
v-yingjl
6 years agoCommunity Support
Hi Anonymous ,
Modify the formula like this:
EVALUATE
VAR tab =
SUMMARIZE(
FILTER(
'Inv_Fact_Inventory',
'Inv_Fact_Inventory'[Dashboard] = "Current Inventory" &&
'Inv_Fact_Inventory'[Inventory Order Type] = "TENDERED" &&
'Inv_Fact_Inventory'[Inventory Status] = "ASSIGNED"
),
'Inv_Fact_Inventory'[Received Date],
"Units Assigned",
CALCULATE(COUNT(Inv_Fact_Inventory[CURINV_CARGO_ID]))
)
RETURN
SELECTCOLUMNS(
tab,
"Final_Cut",
var d = 'Inv_Fact_Inventory'[Received Date]
return
SUMX(
FILTER(
tab,
[Received Date] <= d
),
[Units Assigned]
)
)
order by [Final_Cut] descYou may get your expected result, below is my sample and result:
Best Regards,
Yingjie Li
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
6 years agoNot applicable
Your solution worked. Thanks for help..