Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Turgpat
Frequent Visitor

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 invoice line in a table. I then have another measure that assigns a category to each of those invoice lines based on the first measure. I then have a third measure that calculates the balance for each invoice line based on the category assigned by the second measure. All measures are working perfectly when I use them in a matrix visual based on the invoice lines.

 

My problem arises when I try to add some additional levels to this visual. I try to get a drill-down view for Business unit, then Commercial unit, and finally the invoice level. The first two levels do not give the required calculation, but the last one is perfect when you reach it.

 

I tried some ideas to fix this, but none is working. The first two levels are not working properly with my measures. I would appreciate some of your ideas.

 

Thank you

1 ACCEPTED SOLUTION
v-yueyunzh-msft
Community Support
Community Support

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

View solution in original post

1 REPLY 1
v-yueyunzh-msft
Community Support
Community Support

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

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.