Forum Discussion
Countrows by summarize and calculate
Hi,
The following measure gives the correct values in power bi but when i am trying to do excel export the total is coming wrong. could any one please modify the below measure.
Measure =
VAR Shortlist =
FILTER(
SUMMARIZE(
'Table',
'Table'[ num ],
"Total", CALCULATE(DISTINCTCOUNT(Sales[Number]),Sales[Status]="Closed")
),
[Total] > 4
)
RETURN
COUNTROWS(Shortlist)
Thanks
6 Replies
- amitchandakSuper User
Anonymous , In case you do sum in excel, some time it might not match, as power bi re calculate the grand total again
- AnonymousNot applicable
Hi amitchandak,
in my above measure there is no scenerio of sum like recalculating the grand total. could you please modify my above measure to give correct totals in both power bi and excel.
Thank you.
- amitchandakSuper User
Anonymous ,Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
- AnonymousNot applicable
Hi Anonymous ,
"Total", CALCULATE(DISTINCTCOUNT(Sales[Number]),Sales[Status]="Closed")
The above formula, what do you want to calculate? DISTINCTCOUNT counts the number of distinct values in a column. If you want to count the number of occurrences of different numbers, you can use the following formula."Total",CALCULATE(COUNT(Sales[Number]),FILTER(ALLEXCEPT(Sales,Sales[Number]),[Status]="Closed"))
What kind of visual is your measure placed in, and are there other columns in it? Because if there are other columns, the result will be different.Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AnonymousNot applicable
Hi Anonymous ,
Could you tell me if your problem has been solved?
If it is, kindly Accept it as the solution. More people will benefit from it.
Or you are still confused about it, please provide me with more details about your problem.
Best Regards,
Stephen Tao