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
Mainer04401
Helper III
Helper III

Allselected in Matrix Drilldown

I created a measure for % of sales with the following measure:

 

Sales Vol Contrib = divide([Total_Vol],calculate([Total_Vol],allselected(StoreList)),0)

 

It works, but in a matrix with a drilldown on the rows, is there a way for the denominator to only include the parent row?

 

See the below screen shot for an example.  [County, State] is the parent rows of [City, State] in the StoreList table ...

drilldown-example.JPG

 

In the example of Portland, ME, how can I make sales vol contribution be 40.5% (1,690 / 4,174) instead of 11% (1,690 / 14,867) as shown, without affecting the parent rows which show the county's contribution to the state?

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @Mainer04401 , I used some simple data to test and get what you required. Please try below method.

 

Sample data 'Sales':

10201.jpg

Create measures:

 

 

Total Sales = SUM(Sales[Total])

Contribution 2 = DIVIDE([Total Sales],CALCULATE([Total Sales],ALLSELECTED(Sales)),0)

Contribution 3 = DIVIDE([Total Sales],CALCULATE([Total Sales],ALLEXCEPT(Sales,Sales[Country, State])),0)

Final Contribution = IF(ISFILTERED(Sales[City, State]),[Contribution 3],[Contribution 2])

 

 

 Put Final Contribution in the matrix and see the result:

10202.jpg

Reference for ISFILTERED: https://docs.microsoft.com/en-us/dax/ISFILTERED-function-dax

 

Best Regards,

Community Support Team _ Jing Zhang

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

View solution in original post

4 REPLIES 4
v-jingzhang
Community Support
Community Support

Hi @Mainer04401 , I used some simple data to test and get what you required. Please try below method.

 

Sample data 'Sales':

10201.jpg

Create measures:

 

 

Total Sales = SUM(Sales[Total])

Contribution 2 = DIVIDE([Total Sales],CALCULATE([Total Sales],ALLSELECTED(Sales)),0)

Contribution 3 = DIVIDE([Total Sales],CALCULATE([Total Sales],ALLEXCEPT(Sales,Sales[Country, State])),0)

Final Contribution = IF(ISFILTERED(Sales[City, State]),[Contribution 3],[Contribution 2])

 

 

 Put Final Contribution in the matrix and see the result:

10202.jpg

Reference for ISFILTERED: https://docs.microsoft.com/en-us/dax/ISFILTERED-function-dax

 

Best Regards,

Community Support Team _ Jing Zhang

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

mahoneypat
Microsoft Employee
Microsoft Employee

Just add the City, State column to your ALLSELECTED as below.

 

Sales Vol Contrib = divide([Total_Vol],calculate([Total_Vol],allselected(StoreList[City, State])),0)

 

Regards,

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


pranit828
Community Champion
Community Champion

Hi @Mainer04401 

try 

Sales Vol Contrib = divide([Total_Vol],calculate(sum([Total_Vol]),allexcept('table','table'[parent1],'table'[parent2])),0)





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile

@pranit828  Thanks but that does not accomplish the desired result

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!

December 2024

A Year in Review - December 2024

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