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
ZW
Frequent Visitor

Dynamically Update DAX with Slicer

Hi all,

I find this forum a valuable resource and am hoping someone can assist me with the below problem.

I have a sample set of personal records, with some data and some n/a.

 

NameBirthdayNationalityGenderAgeOccupationAddress
Steve22/04/1990BritishMale31BuilderScotland
Alicen/aIrishFemalen/an/aIreland
Bobn/aBritishn/a52Teachern/a



My goal is to show how complete these records are (as in, not showing n/a) in the form of a percentage. I have managed to achieve this with 2 columns. The first one counts the number of n/a and returns a percentage:


Count n/a Percentage =
DIVIDE (
COUNTX ( FILTER ( 'Table', 'Table'[Birthday] = "n/a" ), [Birthday] )
+ COUNTX ( FILTER ( 'Table', 'Table'[Nationality] = "n/a" ), [Nationality] )
+ COUNTX ( FILTER ( 'Table', 'Table'[Gender] = "n/a" ), [Gender] )
+ COUNTX ( FILTER ( 'Table', 'Table'[Age] = "n/a" ), [Age] )
+ COUNTX ( FILTER ( 'Table', 'Table'[Occupation] = "n/a" ), [Occupation] )
+ COUNTX ( FILTER ( 'Table', 'Table'[Address] = "n/a" ), [Address] ),
COUNTROWS ( 'Table' ) * 7
)

The second column calculates the reverse of this to show percentage complete

Percentage Complete = DIVIDE(100 - ('Table'[Count n/a Percentage]*100),100)

 

This works fine as seen below:

ZW_0-1643044213340.png

 

However, if I use Name as a slicer this percentage doesn’t change to show only the percentage complete in that row.

ZW_4-1643044414198.png

 

 

My ideal output would be this:

ZW_2-1643044295560.pngZW_1-1643044287576.png

ZW_3-1643044305620.png

Any help would be greatly appreciated.

Thank you

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@ZW , I think this correct as measure.

Count n/a Percentage =
DIVIDE (
COUNTX ( FILTER ( 'Table', 'Table'[Birthday] = "n/a" ), [Birthday] )
+ COUNTX ( FILTER ( 'Table', 'Table'[Nationality] = "n/a" ), [Nationality] )
+ COUNTX ( FILTER ( 'Table', 'Table'[Gender] = "n/a" ), [Gender] )
+ COUNTX ( FILTER ( 'Table', 'Table'[Age] = "n/a" ), [Age] )
+ COUNTX ( FILTER ( 'Table', 'Table'[Occupation] = "n/a" ), [Occupation] )
+ COUNTX ( FILTER ( 'Table', 'Table'[Address] = "n/a" ), [Address] ),
COUNTROWS ( 'Table' ) * 7
)

 

Not as column , as first row do not have any N/a and it 71 %

 

 

you can have column like

 

Count n/a Percentage =
DIVIDE (
if('Table'[Birthday] = "n/a" ,1,0 )
+if('Table'[Nationality] = "n/a" ,1,0 )
+if('Table'[Gender] = "n/a" ,1,0 )
+if('Table'[Age] = "n/a" ,1,0 )
+if('Table'[Occupation] = "n/a" ,1,0 )
+if('Table'[Address] = "n/a" ,1,0 ) ,
7
)

 

 

But my advice is use first one as a measure

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
ZW
Frequent Visitor

Thank you, I didn't realise columns and measures behaved differently when it came to splicing. 

The new measure works perfectly!

amitchandak
Super User
Super User

@ZW , I think this correct as measure.

Count n/a Percentage =
DIVIDE (
COUNTX ( FILTER ( 'Table', 'Table'[Birthday] = "n/a" ), [Birthday] )
+ COUNTX ( FILTER ( 'Table', 'Table'[Nationality] = "n/a" ), [Nationality] )
+ COUNTX ( FILTER ( 'Table', 'Table'[Gender] = "n/a" ), [Gender] )
+ COUNTX ( FILTER ( 'Table', 'Table'[Age] = "n/a" ), [Age] )
+ COUNTX ( FILTER ( 'Table', 'Table'[Occupation] = "n/a" ), [Occupation] )
+ COUNTX ( FILTER ( 'Table', 'Table'[Address] = "n/a" ), [Address] ),
COUNTROWS ( 'Table' ) * 7
)

 

Not as column , as first row do not have any N/a and it 71 %

 

 

you can have column like

 

Count n/a Percentage =
DIVIDE (
if('Table'[Birthday] = "n/a" ,1,0 )
+if('Table'[Nationality] = "n/a" ,1,0 )
+if('Table'[Gender] = "n/a" ,1,0 )
+if('Table'[Age] = "n/a" ,1,0 )
+if('Table'[Occupation] = "n/a" ,1,0 )
+if('Table'[Address] = "n/a" ,1,0 ) ,
7
)

 

 

But my advice is use first one as a measure

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.