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

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.


Go to My LinkedIn Page


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.


Go to My LinkedIn Page


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