Forum Discussion

Dimitris_Kats's avatar
2 years ago

Calculation group that affects calculation item

Hello dear members

 

I have created a calculation group that actually reference measures.

So I have a calculation item for actual sales =[sales]

A calculation item for PY sales =[PY sales]

A calculation item for YOY% =[YOY],

A calculation item for Target sales =[target]

And calculation item for Target dif=[target dif]

I have added all of them in to a matrix.

Now I want to add a button and change between 2 different targets. Target 1 and target 2.

I have created a separated table with target 1 and Target 2 and I have used an if statement to change the measure based on the selection.

The target measure is something like that 

If( selectedvalue(target[target])="target 1", [target1], [target2])

It works fine but I was wondering if there is a more efficient way to resolve this and if it is possible to resolve it again by using calculation group.

 

Thank you in advance 🙂

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi, Dimitris_Kats 

    Maybe you can use SELECTEDVALUE with Switch

    Target Selection = 
    SWITCH(
        SELECTEDVALUE('Target Selection'[Target], "Default"),
        "Target 1", [target1],
        "Target 2", [target2],
        [target1]
    )
    

    Or add calculated items for each objective, and in this calculated group, create two calculated items, one for target1 and one for target2, you can check the following link:

    Create calculation groups in Power BI (preview) - Power BI | Microsoft Learn

     

    How to Get Your Question Answered Quickly 

    Best Regards

    Yongkang Hua

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

     

    • Dimitris_Kats's avatar
      Dimitris_Kats
      Helper V

      Thank you so much Anonymous for your answer. I will try both solutions! 🙂

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi, Dimitris_Kats 

        Have you solved your problem? If so, can you share your solution here and mark the correct answer as a standard answer to help other members find it faster? Thank you very much for your kind cooperation!

        Best Regards

        Yongkang Hua