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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Naveen29
Helper II
Helper II

DAX Help

I have created Matrix table and showing measure (actual %) . Here is sample data and calucaiton. In The final output table I dont want to show the 'Regional All' category . When I filtered out (category = Regional All) ,the actual % is become null.

how to write perfrect DAX to handle this Actual % calucaiton.

Region1CategorySalesCalcuation for actual % Actual %
    = Store1+Store2+Store3/(Region All) for region11.22
 Store120  
 Store240  
 Store350  
 Region All90  
Region2   = Store1+Store2+Store3/(Region All) for region20.75
 Store110  
 Store220  
 Store330  
 Region All80  
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Naveen29 ,

I guess the reason for this is that the DAX function is affected by an external filter, my suggestion is to use the VAR function to solve this. Variables are evaluated when they are defined, not when they are used. Variables cannot be modified after assignment. We can think of it as a constant.

 

We can solve this problem by defining "Region All" in measure as a variable and using it later.
Try this measure.

 

Calcuation for actual % = 
VAR __all =
CALCULATE (
SUM ( 'Table'[Sales] ),
ALLEXCEPT ( 'Table', 'Table'[Region] ),
'Table'[Category] = "Region All"
)
RETURN
DIVIDE ( CALCULATE (
SUM ( 'Table'[Sales] ),
ALLEXCEPT ( 'Table', 'Table'[Region] ),
'Table'[Category] <> "Region All"
), __all )

 

The result should be like this.

vcgaomsft_0-1644571820947.png

Maybe you want another result like this.

vcgaomsft_2-1644572059940.png

Try this measure.

 

VAR __all =
CALCULATE (
SUM ( 'Table'[Sales] ),
ALLEXCEPT ( 'Table', 'Table'[Region] ),
'Table'[Category] = "Region All"
)
RETURN
DIVIDE ( SUM ( 'Table'[Sales] ), __all )

 

Also, attached the pbix file as the reference.

 

Best Regards,

Community Support Team_Gao

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @Naveen29 ,

I guess the reason for this is that the DAX function is affected by an external filter, my suggestion is to use the VAR function to solve this. Variables are evaluated when they are defined, not when they are used. Variables cannot be modified after assignment. We can think of it as a constant.

 

We can solve this problem by defining "Region All" in measure as a variable and using it later.
Try this measure.

 

Calcuation for actual % = 
VAR __all =
CALCULATE (
SUM ( 'Table'[Sales] ),
ALLEXCEPT ( 'Table', 'Table'[Region] ),
'Table'[Category] = "Region All"
)
RETURN
DIVIDE ( CALCULATE (
SUM ( 'Table'[Sales] ),
ALLEXCEPT ( 'Table', 'Table'[Region] ),
'Table'[Category] <> "Region All"
), __all )

 

The result should be like this.

vcgaomsft_0-1644571820947.png

Maybe you want another result like this.

vcgaomsft_2-1644572059940.png

Try this measure.

 

VAR __all =
CALCULATE (
SUM ( 'Table'[Sales] ),
ALLEXCEPT ( 'Table', 'Table'[Region] ),
'Table'[Category] = "Region All"
)
RETURN
DIVIDE ( SUM ( 'Table'[Sales] ), __all )

 

Also, attached the pbix file as the reference.

 

Best Regards,

Community Support Team_Gao

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.