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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.