Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Take the diferrence between two parameter

Hi everyone, I created two parameters with lists of measures, two slicers and one matrix with these parameters. My question is, Is it possible to create a measure to calculate the difference betwee...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi  Anonymous ,

     

    I created some data:

    If you want to add a row to a matrix Row, you need to create a new table column as a Row, and then create a measure that uses the switch() function to determine the value corresponding to each value.

     

    Here are the steps you can follow:

    1. Enter data – create a table.

    According to the Power BI design, the default sorting is alphabetical, so we need an Index to customize the sorting.

    [Group] – Column tools – Sort by column – [lndex]

    2. Create measure.

    Test =
    SWITCH(
        TRUE(),
         MAX('Row_Group'[Group])="MEASURE1",[Parameter_Measures],
         MAX('Row_Group'[Group])="MEASURE2",[Parameter_Measures2],
        MAX('Row_Group'[Group])="DIFFERENCE",[Parameter_Measures] - [Parameter_Measures2])

    3. Result:

     

    If it doesn't meet your desired outcome, can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi my friend,

    I really liked your idea, but I got a simpler solution.

    The measurements are then based on a single table that isn't that big, so I made a copy of the table and created similar versions of the measurements,
    like this

    table 1 and measurements: 1, 2, 3
    table 1a and measurements: 1a, 2a, 3a

    So I created the parameters for measurements.

     

    but thanks for all