Forum Discussion
SQL to DAX Convert
- 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.
Thanks for your reply! . I'm having issue at this step:
EVALUATE
SUMMARIZE (
FILTER ( Inv_Fact_Inventory,
Inv_Fact_Inventory[Dashboard]="Current Inventory" && Inv_Fact_Inventory[Inventory Status]="ASSIGNED" && Inv_Fact_Inventory[Inventory Order Type]="TENDERED NOT SHIPPED" ),
,
"Final_date", Inv_Fact_Inventory[Received Date],
"Units Assigned", DISTINCTCOUNT(Inv_Fact_Inventory[CURINV_CARGO_ID])
)
At Final_Date, below is the error
Next when i try to run the whole expression im getting the same value for all records.Am i missing something here..
Here is the updated code im using now:
EVALUATE
VAR tab =
SUMMARIZE (
FILTER (
Inv_Fact_Inventory,
Inv_Fact_Inventory[Dashboard]="Current Inventory" && Inv_Fact_Inventory[Inventory Status]="ASSIGNED" && Inv_Fact_Inventory[Inventory Order Type]="TENDERED NOT SHIPPED"
),
Inv_Fact_Inventory[Received Date],
"Units Assigned", DISTINCTCOUNT( Inv_Fact_Inventory[CURINV_CARGO_ID] )
)
RETURN
SELECTCOLUMNS (
tab,
"Final_cut", SUMX ( FILTER ( tab, Inv_Fact_Inventory[Received Date] <= MAX ( Inv_Fact_Inventory[Received Date] ) ), [Units Assigned] )
)
Output:
Please advice
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.
- Anonymous6 years agoNot applicable
Your solution worked. Thanks for help..