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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Cyriackpazhe
Helper III
Helper III

DAX

Screenshot (43).pngScreenshot (44).png

In the first measure, I'm trying to compute the average quarterly sales and next measure the average montly sales in each year. In the first mesure, i should be getting the year level value in the quarter level as well since there is an ALL function around the quarter column, but why am i getting this result. Same issue with the second measure. Any reason why this is happening

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

Hi @Cyriackpazhe,

Thank you for reaching out to the Microsoft fabric community forum. Thank you @some_bih, for your inputs on this issue.

 

Thank you for bringing this to my attention. Upon reviewing your DAX measures, I noticed the inconsistency in average quarterly and monthly sales across different periods, even with the ALL() function applied.

This occurs because ALL('Calendar'[Quarter]) or ALL('Calendar'[Month]) only removes the filter for that specific column. However, in a matrix visual with a hierarchy (such as Year > Quarter or Year > Month), the row-level filters from the visual still affect the context, resulting in varying outcomes for each row.

To ensure the calculation is performed at the year level and the same value is displayed across quarters or months in the matrix, you can use the following DAX measures with ALLEXCEPT, which retains only the Year filter:

Quarterly Average:

DAX

CopyEdit

Quarterly Average =

CALCULATE (

    AVERAGEX (

        VALUES ( 'Calendar'[Quarter] ),

        [Total Sales]

    ),

    ALLEXCEPT ( 'Calendar', 'Calendar'[Year] )

)

 

Monthly Average:

DAX

CopyEdit

Monthly Average =

CALCULATE (

    AVERAGEX (

        VALUES ( 'Calendar'[Month] ),

        [Total Sales]

    ),

    ALLEXCEPT ( 'Calendar', 'Calendar'[Year] )

)

 

ALLEXCEPT clears all filters from the Calendar table except for Year, so the average is always calculated at the year level just as intended. This approach avoids row context interference from the visual (like month or quarter rows).

If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.

Thank you for using Microsoft Community Forum.

View solution in original post

7 REPLIES 7
v-kpoloju-msft
Community Support
Community Support

Hi @Cyriackpazhe,

Thank you for reaching out to the Microsoft fabric community forum. Thank you @some_bih, for your inputs on this issue.

 

Thank you for bringing this to my attention. Upon reviewing your DAX measures, I noticed the inconsistency in average quarterly and monthly sales across different periods, even with the ALL() function applied.

This occurs because ALL('Calendar'[Quarter]) or ALL('Calendar'[Month]) only removes the filter for that specific column. However, in a matrix visual with a hierarchy (such as Year > Quarter or Year > Month), the row-level filters from the visual still affect the context, resulting in varying outcomes for each row.

To ensure the calculation is performed at the year level and the same value is displayed across quarters or months in the matrix, you can use the following DAX measures with ALLEXCEPT, which retains only the Year filter:

Quarterly Average:

DAX

CopyEdit

Quarterly Average =

CALCULATE (

    AVERAGEX (

        VALUES ( 'Calendar'[Quarter] ),

        [Total Sales]

    ),

    ALLEXCEPT ( 'Calendar', 'Calendar'[Year] )

)

 

Monthly Average:

DAX

CopyEdit

Monthly Average =

CALCULATE (

    AVERAGEX (

        VALUES ( 'Calendar'[Month] ),

        [Total Sales]

    ),

    ALLEXCEPT ( 'Calendar', 'Calendar'[Year] )

)

 

ALLEXCEPT clears all filters from the Calendar table except for Year, so the average is always calculated at the year level just as intended. This approach avoids row context interference from the visual (like month or quarter rows).

If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.

Thank you for using Microsoft Community Forum.

Hi @Cyriackpazhe,

 

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

Thank you.

Hi @Cyriackpazhe,


I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.


Thank you.

Hi @Cyriackpazhe,


I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.


Thank you.

some_bih
Super User
Super User

Hi @Cyriackpazhe try this version for your measure

Quarterly Average Test =
AVERAGEX(
VALUES('Calendar'[Date]),
CALCULATE([Total], ALL('Calendar'[Date]))
)





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






But what was the error with what i wrote??

It was supposed to give the result as expected right

Hi @Cyriackpazhe 

measure might aggregate values across all quarters rather than respecting the context of year and quarter





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.