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
sizi
Helper II
Helper II

SLA visual to display breach or complaint records based on Start and End date

Dear all,

 

I need your help in visualizing SLA status on pie chart, where i want to show number of task thats "Breached or Complaint ".

 

The scenario is I have multiple dates from one record and my current date filter when filtered will show the tasks even if one date in a task falls in the date selection. My sample data is as shown below:

Task NamePlanned DatePlanned End Date Start dateEnd DateInitial Datefinal DateSLA Status
Task11-Mar-245-Mar-241-Mar-247-Mar-249-Mar-2411-Mar-24Breached
Task21-Feb-245-Feb-242-Feb-247-Feb-249-Mar-2411-Mar-24Complaint
Task31-Jan-245-Jan-245-Feb-2415-Feb-249-Mar-2411-Mar-24Breached
Task41-Jan-2410-Jan-242-Jan-247-Jan-249-Mar-2411-Mar-24Complaint

 

Now my issue is when i apply date filter to show last 2 months data, the visual shows breach count is 2 and Complaint count is 2 which shouldnt be the case. It should show complaint = 1 and breached = 2 as i want the SLA display to be only based on Start and End date and task 4 does not fall in the date range category eventhough it has current date in the task. SLA is calculated based on Start and End date .Kindly help as i am not able to figure out a way around this problem.

 

Thanks,

2 REPLIES 2
Sahir_Maharaj
Super User
Super User

Hello @sizi,

 

Can you please try the following DAX:

Breached Count = 
CALCULATE(
    COUNTROWS('YourTable'),
    'YourTable'[SLA Status] = "Breached",
    NOT(ISBLANK('YourTable'[Start date])),
    NOT(ISBLANK('YourTable'[End Date])),
    USERELATIONSHIP('YourTable'[Start date], 'CalendarTable'[Date]),
    USERELATIONSHIP('YourTable'[End Date], 'CalendarTable'[Date])
)
Compliant Count = 
CALCULATE(
    COUNTROWS('YourTable'),
    'YourTable'[SLA Status] = "Complaint",
    NOT(ISBLANK('YourTable'[Start date])),
    NOT(ISBLANK('YourTable'[End Date])),
    USERELATIONSHIP('YourTable'[Start date], 'CalendarTable'[Date]),
    USERELATIONSHIP('YourTable'[End Date], 'CalendarTable'[Date])
)

Hope this helps!


Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution?
➤ Lets connect on LinkedIn: Join my network of 13K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

Hi Sahir,

 

Thank you for looking into this. However the dax is giving me error as below:

 

USERELATIONSHIP function can only use the two columns references participating in relationship.

Please note my date filter is defined to consider any single date available in the task and i want sla to show the records only if start and end date is within the date filter selected even if the task has recent date which falls under date filter range, it should exclude. 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Fabric Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.