Forum Discussion
JVK
1 year agoNew Member
Facing LOD issues while trying to convert the Tableau calculated fields into PowerBI DAX
We are facing LOD issues, the dax which we are creating is also LOD which in turn is calling LOD itself in the Dax. Tableau Calculated Field: NValue=IF [Invoiced Flag] = TRUE and [GR Value Flag...
Anonymous
1 year agoNot applicable
Hi JVK
Please try the following Dax:
NValue =
VAR InvoicedFlag = SELECTEDVALUE(Append1[Invoiced Flag Sample])
VAR GRValueFlag = SELECTEDVALUE(Append1[GR Value Flag sample])
RETURN
SWITCH(
TRUE(),
InvoicedFlag = TRUE() && GRValueFlag = TRUE(),
CALCULATE(SUM(Append1[IR-SD Value (LOD) (USD)]), ALLEXCEPT(Append1, Append1[PO Line - Ref Doc])),
InvoicedFlag = FALSE() && GRValueFlag = TRUE(),
CALCULATE(SUM(Append1[GR Value (USD)]), ALLEXCEPT(Append1, Append1[PO Line - Ref Doc])),
0
)
-
Variable Definitions:
- InvoicedFlag : Retrieves the value of [Invoiced Flag] Sample in the current context.
- GRValueFlag : Retrieves the value of [GR Value Flag] sample in the current context.
-
SWITCH Statement: Returns different calculation results based on conditions.
- If both InvoicedFlag and GRValueFlag are TRUE, it calculates the sum of [IR-SD Value (LOD) (USD)] at the [PO Line - Ref Doc] level.
- If InvoicedFlag is FALSE and GRValueFlag is TRUE, it calculates the sum [GR Value (USD)] of at the [PO Line - Ref Doc] level.
- If none of these conditions are met, it returns 0.
Best Regards,
Jayleny
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.