Forum Discussion

Turgpat's avatar
Turgpat
Frequent Visitor
3 years ago
Solved

Need some new ideas to solve a problem - Measure

Bonjour,   I need some new ideas to solve a problem as I feel I'm turning in circles. I will summarize the situation. I have a measure that calculates the date difference between two items for each...
  • v-yueyunzh-msft's avatar
    3 years ago

    Hi, Turgpat 

    According to your description, you created 3 measures to get the value you want. When you look at a certain dimension, the values returned by your 3 measures are all correct. But when you add other dimensions, it doesn't return the correct value in some dimensions.
    For this problem, it is generally related to the filtering context of the measurement value. When you add a new dimension, the filtering context will become larger or smaller accordingly.
    You can try to use isinscope() and if() or switch() functions to judge your current dimension, and then make these three measures return the values you want in all dimensions according to your different dimensions.
    And when calculating, you can use functions such as filter() or all() to filter data and ignore the filtering context of certain fields.

    For more information, you can refer to :
    Use IsInScope to get the right hierarchy level in DAX - Kasper On BI

    ISINSCOPE function (DAX) - DAX | Microsoft Learn

     

    Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

     

    Best Regards,

    Aniya Zhang

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