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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
JulieB_
Helper I
Helper I

Calculate Row and Total Percentage on Selection of Rows

Hi, 

 

I need to create a DAX measure that calculates the Picking % only for the columns with Comment Good

Picking % = 1 - ( Difference between Initial and Control / Control )

 

I have this example table: 

 InitialPrepControlCommentDiff Initial & ControlPicking %
 008Error?80%
 300Manquant3#DIV/0!
 002563Error25630%
 220Error?2#DIV/0!
 111Good0100%
 222Good0100%
 552Good3-0,5
TOTAL885 340%

 

What DAX measure should I write? 

 

Thank you 

Julie

3 REPLIES 3
JulieB_
Helper I
Helper I

HI @jewel_at ,

when I add your measure in a table I get correct row values.

But the total value is left blank or takes the sum. 
When I select some rows in my table (only the 'Good' ones) then the measure takes the sum of the Picking Accuracy (100% + 100% + 100% = 300%). Which is not the correct total (100% + 100% + 100% = should be 100%). 

You know how to get the total value?

Hi @JulieB_ 

I updated my original response. The reason the total was left blank when there are other not "Good" comments is because, I assigned "" instead of 0. 

Are you looking for the average instead of Total Sum? You can use AVERAGEX instead 🙂

 

 

 

jewel_at
Helper II
Helper II

Hi @JulieB_ 

 

Have you tried:

 

Picking % = 
var Comment = SELECTEDVALUE('Table'[Comments])
return IF (Comment = "Good", SUMX('Table', 1 - ('Table'[Diff Initial] - 'Table'[Control]/'Table'[Control])),0)

 

 

Hope that helps!

 

Jewel

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors