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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

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 6
Anonymous
Not 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

Anonymous
Not 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.

 

amitchandak
Super User
Super User

@Anonymous , In case you do sum in excel, some time it might not match, as power bi re calculate the grand total again

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
Anonymous
Not 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.

@Anonymous ,Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

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
Anonymous
Not applicable

Hi @amitchandak,

As it is difficult to provide sample data,

you can consider table in my measure as customer table from adventureworks data ware house and  Sales[Number]) and Sales[Status] also from adventureworks data ware house. 

 

Thanks.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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.