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
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
v-stephen-msft
Community Support
Community Support

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

v-stephen-msft
Community Support
Community Support

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

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.

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