Forum Discussion
How to replicate a tableau Calculation in Power BI
- 8 months ago
@sahooak , try one of the two
CALCULATE(
[Ship Amt CQ Pull In] ,
allexcept('Data', 'Data'[Product] ), 'Data'[Product] = "Chair"
)
or
CALCULATE(
sumx(filter('Data'), 'Data'[Product] = "Chair"), [Ship Amt CQ Pull In] ,
allexcept('Data', 'Data'[Product] )
) - 8 months ago
Hi sahooak ,
Thank you for reaching out to the Microsoft Community Forum.
Please refer below DAX measure.
Ship Amt CQ Pull In LOD =
VAR FilteredTable =
FILTER(
ALL('Data'),
'Data'[Product] = "Chair"
&& 'Data'[Order Day Number] < 'Data'[CurrentDayNumber]
)
RETURN
CALCULATE(
[Ship Amt CQ Pull In],
FilteredTable
)Please refer below DAX measure without variables.
Ship Amt CQ Pull In LOD =
CALCULATE(
[Ship Amt CQ Pull In],
ALL('Data'),
'Data'[Product] = "Chair",
'Data'[Order Day Number] < 'Data'[CurrentDayNumber]
)I hope this information helps. Please do let us know if you have any further queries.
Regards,
Dinesh
Thank you for your reply. Your DAX is not working.
For the Fixed LOD I have created this is DAX which shows the same output like Tableau. BUT how can I add this
VAR FilteredTable =
FILTER(
ALL('Data'),
'Data'[Product] = "Chair"
)
VAR TotalShip =
CALCULATE(
[Ship Amt CQ Pull In] ,
FilteredTable
)
RETURN
TotalShip
sahooak , try one of the two
CALCULATE(
[Ship Amt CQ Pull In] ,
allexcept('Data', 'Data'[Product] ), 'Data'[Product] = "Chair"
)
or
CALCULATE(
sumx(filter('Data'), 'Data'[Product] = "Chair"), [Ship Amt CQ Pull In] ,
allexcept('Data', 'Data'[Product] )
)