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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
yaman123
Post Patron
Post Patron

Incorrect Total in table

Hi, 

 

I have the measure to count how many members have that ppl category. 

No of Members = (IF([Total PPL] = BLANK(),BLANK(),CALCULATE(DISTINCTCOUNT('Payment by Member Query'[MEMBER_CODE]))))
 
But this is not returning the correct total at the bottom of the table. The total i am getting is 711 but it should be 690. 
 
I would like the measure to only calculate is the value is not blank in the table.
 
Capture.PNG
 
TIA 
 
Yasir
 
 
1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi, @yaman123 

Please try the below measure.

 

No of Members =
COUNTROWS (
FILTER (
VALUES ( 'Payment by Member Query'[MEMBER_CODE] ),
NOT ISBLANK ( [Total PPL] )
)
)

 

Hi, My name is Jihwan Kim.

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

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

8 REPLIES 8
Jihwan_Kim
Super User
Super User

Hi, @yaman123 

Please try the below measure.

 

No of Members =
COUNTROWS (
FILTER (
VALUES ( 'Payment by Member Query'[MEMBER_CODE] ),
NOT ISBLANK ( [Total PPL] )
)
)

 

Hi, My name is Jihwan Kim.

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

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Great thank you! 

 

Also i would like to calculate the % e.g No of Members / Total. How can this be written. I have a measure and it isnt taking into account the correct figures.

 

% PPL = [No of Members]/CALCULATE(DISTINCTCOUNT('Payment by Member Query'[MEMBER_CODE]),ALLSELECTED())
 
It should give a total of 100% but showing as 97.05%
 
Capture.PNG

Hi, @yaman123 

Thank you for your feedback.

I think the distinctcount/allselect in  %PPL measure = counting all members including zero sales.

I think this percentage is also useful, but if you don't need this, then you can distinct count all members who has non-zero-sales. Something like below...

 

calculate (

COUNTROWS (
FILTER (
VALUES ( 'Payment by Member Query'[MEMBER_CODE] ),
NOT ISBLANK ( [Total PPL] )
), allselected(PPLBUCKET)
)

 

Thank you.

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Hi @Jihwan_Kim 

 

I am getting the results as 1 instead of the percentage 

 

Sorry if i am not writing the dax query correctly, i have the below query:

 

Measure = [No of Members]/CALCULATE(COUNTROWS(FILTER(VALUES('Payment by Member Query'[MEMBER_CODE]),NOT ISBLANK([Total Milk PPL]))),ALLSELECTED('Payment by Member Query'[MEMBER_CODE]))
 
Capture.PNG
 

Hi,

if it is OK with you, please share the sample pbix file, then I can try to come up with a more accurate mesure.

 

thanks.

 

Hi, My name is Jihwan Kim.

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

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


hI @Jihwan_Kim 

 

Theres a lot of private information in the file. I can share the table and measures.

 

Measure = [No of Members]/CALCULATE(COUNTROWS(FILTER(VALUES('Payment by Member Query'[MEMBER_CODE]), NOT ISBLANK([Total Milk PPL]))),ALLSELECTED())
 
% PPL = [No of Members]/CALCULATE(DISTINCTCOUNT('Payment by Member Query'[MEMBER_CODE]),ALLSELECTED())
 
No of Members =
COUNTROWS (
FILTER (
VALUES ( 'Payment by Member Query'[MEMBER_CODE] ),
NOT ISBLANK ( [Total Milk PPL] )
)
)

Hi, terribly sorry to say that please check your last measure.

Is it giving the result = 1 ??

When I tested it, it gave me an error.

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Hi @Jihwan_Kim 

 

I think i have solved this. I have created a new measure 

 

Total No of Members = CALCULATE(COUNTROWS(FILTER(VALUES('Payment by Member Query'[MEMBER_CODE]),NOT ISBLANK([Total Milk PPL]))),ALLSELECTED())
 
then i create another measure to divide by no of members. 
 
Measure = [No of Members]/[Total No of Members]
 
Is it probably a long winded way of doing it but it gives me the correct figures in the table. 
 
Thanks for your help, much appreciated! 
 
 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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