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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Calculate difference

Hello People,

I am facing an issue while calculating differences in the matrix. For example,
In the below image as you can see where there is a blank, the difference is coming 0 whereas it should come 3. I have used the following formula for calculating difference:
Diff = CALCULATE (
DISTINCTCOUNT('Question and Answer'[Respondent ID]),
FILTER (
'Question and Answer' ,
'Question and Answer'[Start Date] = max('Question and Answer'[Start Date])
))
- CALCULATE (
DISTINCTCOUNT('Question and Answer'[Respondent ID]),
FILTER (
'Question and Answer' ,
'Question and Answer'[Start Date] = min('Question and Answer'[Start Date])
))

difference cal.PNG

 

 

 

 

 

 

 

Any help would be appreciated. Thanks!

5 REPLIES 5
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your data model looks like,

but I assume that

Rather Not Say -> only has June 23rd 2021. 

 

If the above assumption is true, then min date and max date are the same. ->  So, the calculation is 3 - 3 = 0

 

If the above assumption is not true, please share your sample pbix file, then I can try to look into it to come up with accurate measure.

 

thanks.


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.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Anonymous
Not applicable

Thanks for your response, the assumption is true Rather not say has only 23rd June. In this case is there any alternate option?

Hi,

thank you for your feedback.

In my opinion, you can try to create a condition inside your measure, something like mentioning about the below.

 

if there is only one date visibile per category, then max value is the visible value, and min value is zero.

if there are more than two dates visible per category, then simple max -min.

 

Please try to implement the above logic.

Or, please share your sample pbix file, then I can try to write accurate measure for your data model.

 

Thanks.

 


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.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Anonymous
Not applicable

I will try to implement the above logic.

Also, attaching the .pbix file.

 

https://1drv.ms/u/s!Atnt-zbKkySJghuDqJfFfbbgG_sW?e=TrDcFl 

 

Thanks!

Anonymous
Not applicable

Hello Community

 

Any luck on finding the solution?

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.