cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Measure: Calculate and Filter

Hey guys,

 

could you please help me with the following Measure? 

 

I would like to show the "number of services with major incident" per Business Unit nin a way, that if a service had multiple major incidents it should still be counted 1 time (as it is the same service).

 

I have currently the following formula for the measure: - the filter part is linked to a slicer, that can be changed to any time interval.

 

Number of Services with Major Incident = CALCULATE(COUNTA('Incident Report'[ASPStatusID]);FILTER('Incident Report';'Incident Report'[ASPStatusID]=1);
FILTER('Incident Report';(CALCULATE(MIN('Incident Report'[Incident Start Date]))>=CALCULATE(MIN('CALENDAR'[Date])) && CALCULATE(MAX('Incident Report'[Incident Start Date]))<=CALCULATE(MAX('CALENDAR'[Date])+1)||CALCULATE(MIN('Incident Report'[Incident End Date]))>=CALCULATE(MIN('CALENDAR'[Date])) && CALCULATE(MAX('Incident Report'[Incident End Date]))<=CALCULATE(MAX('CALENDAR'[Date])+1)))
) + 0
 
The issue I am facing, is that the formula counts the sum of all the major incidents per Business Unit.
 
So for example on the attached screenshot for the Finance we should see "2" instead of "3" as there are 2 different services and not 3.
 
The power bi file is also uploaded here:
 
 
Any help is greatly appreciated,
 
Many thanks,
 
Adam
 
calculateandfilter.JPG
1 ACCEPTED SOLUTION

Accepted Solutions
Moderator v-yuezhe-msft
Moderator

Re: Measure: Calculate and Filter

@Anonymous,

Please change your DAX to the following:

Number of Services with Major Incident = CALCULATE(DISTINCTCOUNT('Incident Report'[Title]),FILTER('Incident Report','Incident Report'[ASPStatusID]=1),
FILTER('Incident Report',(CALCULATE(MIN('Incident Report'[Incident Start Date]))>=CALCULATE(MIN('CALENDAR'[Date])) && CALCULATE(MAX('Incident Report'[Incident Start Date]))<=CALCULATE(MAX('CALENDAR'[Date])+1)||CALCULATE(MIN('Incident Report'[Incident End Date]))>=CALCULATE(MIN('CALENDAR'[Date])) && CALCULATE(MAX('Incident Report'[Incident End Date]))<=CALCULATE(MAX('CALENDAR'[Date])+1)))
      ) + 0


Moreover, please mask your sensitive information such as account name and password when uploading your screenshots.

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Moderator v-yuezhe-msft
Moderator

Re: Measure: Calculate and Filter

@Anonymous,

Please change your DAX to the following:

Number of Services with Major Incident = CALCULATE(DISTINCTCOUNT('Incident Report'[Title]),FILTER('Incident Report','Incident Report'[ASPStatusID]=1),
FILTER('Incident Report',(CALCULATE(MIN('Incident Report'[Incident Start Date]))>=CALCULATE(MIN('CALENDAR'[Date])) && CALCULATE(MAX('Incident Report'[Incident Start Date]))<=CALCULATE(MAX('CALENDAR'[Date])+1)||CALCULATE(MIN('Incident Report'[Incident End Date]))>=CALCULATE(MIN('CALENDAR'[Date])) && CALCULATE(MAX('Incident Report'[Incident End Date]))<=CALCULATE(MAX('CALENDAR'[Date])+1)))
      ) + 0


Moreover, please mask your sensitive information such as account name and password when uploading your screenshots.

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Anonymous
Not applicable

Re: Measure: Calculate and Filter

Hey @v-yuezhe-msft,

 

many thanks for your fast reply!

 

Could you please help me with 1 last issue? would it be possible to extend the "number of services with major incident" to "number of services with incident"?

 

So it counts also if a service has an incident that is either major/critical = ASPStatusID1 or ASPStatusID2? 

 

Currently it's counting the ones, where ASPStatusID=2.

 

I would really appreciate!

 

Many thanks,

 

Adam

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 330 members 3,443 guests
Please welcome our newest community members: