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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
pradeepyadav921
Frequent Visitor

Calculating sla status for the previous date

Hi team, 

I am trying to create a table where there is four header as category, today date, yesterday date and day before yesterday date. I have a sheet where headers are category, file name, date and sla status. Now I want to create a traffic light system table where suppose if we have category A and under category A there is 10 files if all files have sla status as met it should show green for whatever date I am selecting if on 9 files have sla status as met it should red as traffic light system. 

 

I have tried but I am able to calculate value for the date I am selecting from a date picker but for yesterday and day before yesterday it is giving a blank value. Can anyone help me with the DAX

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @pradeepyadav921 ,

I create a table as you mentioned.

vyilongmsft_0-1714528642278.png

Then I create two measures, here are the DAX codes.

SLAMetCount =
VAR _A = CALCULATE ( COUNTROWS ( 'Table' ) ) RETURN IF ( _A = 1, 1, 0 )
Measure = 
VAR _SLAMetToday = 'Table'[SLAMetCount]
RETURN
    IF (
        _SLAMetToday = 10,
        UNICHAR ( 128994 ),
        IF ( _SLAMetToday >= 9, UNICHAR ( 1288993 ), UNICHAR ( 128308 ) )
    )

vyilongmsft_1-1714528762360.png

I think you can use this DAX code for a try.

SLAMetCountYesterday = CALCULATE(
    [SLAMetCount],
    DATEADD('YourTable'[Date], -1, DAY)
)

 

 

 

Best Regards

Yilong Zhou

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

1 REPLY 1
Anonymous
Not applicable

Hi @pradeepyadav921 ,

I create a table as you mentioned.

vyilongmsft_0-1714528642278.png

Then I create two measures, here are the DAX codes.

SLAMetCount =
VAR _A = CALCULATE ( COUNTROWS ( 'Table' ) ) RETURN IF ( _A = 1, 1, 0 )
Measure = 
VAR _SLAMetToday = 'Table'[SLAMetCount]
RETURN
    IF (
        _SLAMetToday = 10,
        UNICHAR ( 128994 ),
        IF ( _SLAMetToday >= 9, UNICHAR ( 1288993 ), UNICHAR ( 128308 ) )
    )

vyilongmsft_1-1714528762360.png

I think you can use this DAX code for a try.

SLAMetCountYesterday = CALCULATE(
    [SLAMetCount],
    DATEADD('YourTable'[Date], -1, DAY)
)

 

 

 

Best Regards

Yilong Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Solution Authors