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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

DAX Measure that don't get sliced based on a Table Column

Lets say we have Product table:

ProductidProduct TypeProduct NameTotal Audience
1ABCaaaa300
2ABCbbbb700
3XYZcccc500
4MNO

dddd

1500

 

And another table Audience:

AudienceIDemailProductIDDateActivedaily_Activity
1zzz@yx.com111/3/302114
2qwe@hg.com411/3/202116
3feg@gr.ces312/3/202100
4zzz@yx.com112/3/202113

 

 

In PowerBI:

We have Slicers for Product Type, Product Name, Date

we need to create a table like:

 

Product NameProduct TypeActive Audience %<- CalculationAvg Selected Active Audience %<- Calculation
aaaaABC50%150/30070%700/1000
bbbbABC79%550/70070%700/1000
ccccXYZ90%450/50090%450/500

 

Now if I am only selecting 'aaaa' Product Name from Slicer then the table should be like:

 

Product NameProduct TypeActive Audience %<- CalculationAvg Selected Active Audience %<- Calculation
aaaaABC50%150/30050%150/300

 

Note: if say we have 10 products in ABC category and from Slicer if we select 6 products then Avg Selected Active Audience % should be calculated based on 6 products.

 

I got the DAX for Active Audience %

DAX for Active Audience = CALCULATE(DISTINCTCOUNT('Audience'[email])/SUM('Product'[Total Audience]), FILTER('Product', 'Product'[Product Name] IN ALLSELECTED('Product'[Product Name])))

 

But I am not sure how to calculate the measure for "Avg Selected Active Audience %", the idea is it shows the % by clubing all the Active Audience for a given product type and it only considers Product Names as selected by slicers.

 

Current Issue I am facing: The value of Avg Selected Active Audience % comes same as Active Audience % as the data is getting sliced based on table row; If I show the measure in KPI card for Avg Selected Active Audience % it shows correct value.

 

Could anyone help me figure out the correct DAX for Avg Selected Active Audience %.

1 REPLY 1
lbendlin
Super User
Super User

@Anonymous  first let's assume that you have linked the tables in the data model via the ProductID

lbendlin_0-1629154364916.png

 

Your measure for Active Audience = CALCULATE(DISTINCTCOUNT('Audience'[email])/SUM('Product'[Total Audience]), FILTER('Product', 'Product'[Product Name] IN ALLSELECTED('Product'[Product Name])))  is not correct for product aaaa as that has only one dedicated email address associated.

lbendlin_1-1629155676989.png

Now we get some result by simply counting the emails (without distinct)

 

lbendlin_2-1629155731058.png

 

This is where it breaks down. Your sample data does not support  the 79% value for bbbb.  Can you please explain that part?

Helpful resources

Announcements
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.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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