Forum Discussion

Evelin_'s avatar
Evelin_
Helper I
1 year ago
Solved

Table with values switch to rows, difference, impact columns

Hello,   I have a table where unfortunately I can not figure out how to add 2 types of columns. My base table has 2 version in columns, and some measure in rows.  This is the setup:   DAX...
  • rajendraongole1's avatar
    1 year ago

    Hi Evelin_  - you can create the Difference (pp) measure

     

    Difference_pp =
    VAR CY = [CY selection]
    VAR Base = [Base selection]
    RETURN
    FORMAT(CY - Base, "0.0") & " pp"

     

    you want the impact to be a function of the pp difference and some weighting

     

    Impact =
    VAR pp = [CY selection] - [Base selection]
    -- You can apply a custom logic here
    -- e.g., multiply by a fixed factor, or lookup a weight from a table
    RETURN
    pp * [SomeWeight] -- Or a hardcoded number like 200

     

     

    If the weight is fixed or based on the row context

    Impact =
    VAR pp = [CY selection] - [Base selection]
    VAR impactFactor =
    SWITCH(
    SELECTEDVALUE('MetricsTable'[Metric]),
    "Total", 200,
    "Promo", 100,
    "xx", 10,
    0
    )
    RETURN
    pp * impactFactor

     

     

    Hope this helps.