Forum Discussion
How to replicate a tableau Calculation in Power BI
- 9 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
sahooak , for Fixed LOD refer my video there few thing need to considered
If the first one a column
Ship Amt CQ Pull In =
IF (
'Table'[PullInFlag] = "Y"
&& 'Table'[Current Fiscal Quarter] = 0
&& 'Table'[Product] = "Chair",
'Table'[Ship Amt],
BLANK()
)
measure like
Ship Amt CQ Pull In (Filtered Sum) =
VAR _CurrentDay = MAX('Table'[CurrentDayNumber])
RETURN
CALCULATE(SUM('Table'[Ship Amt CQ Pull In]),
'Table'[Order Day Number] < _CurrentDay
)
Or a measure like , without column
Ship Amt CQ Pull In (Filtered Sum) =
VAR _CurrentDay = MAX('Table'[CurrentDayNumber])
RETURN
CALCULATE(
SUMX(Filter( 'Table', 'Table'[PullInFlag] = "Y"
&& 'Table'[Current Fiscal Quarter] = 0
&& 'Table'[Product] = "Chair")
'Table'[Ship Amt]),
'Table'[Order Day Number] < _CurrentDay
)
for LOD in Tableau vs Power BI - FIXED Level of Detail- https://youtu.be/hU-cVOwDCvY
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
- amitchandak9 months agoSuper User
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] )
)