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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
vickyw
Helper I
Helper I

Counting Strings Returned from an Iterating Measure

Hi All, 

 

Hoping someone can help. 

 

I know columns (DAX or M) are not dynamic so in this situation I have opted to write three DAX measures to ensure my report output is always correct, regardless of when it was last refreshed however, I cannot get the 'Fails' to count.


Example - Fails card should show 12, but instead is 'Blank'

vickyw_1-1720693789405.png

 

Here are the measures used in the above visual.

 

[E2E SLA] - calculates the working days between 2 dates (Case Opened/Case Closed ) or returns null if the case is still open

E2E SLA = 
SUMX(
    'All Cases',
    COUNTROWS(
        FILTER(
            'Date Table Static',
            'Date Table Static'[Date] >= 'All Cases'[Case Created Date] &&
            'Date Table Static'[Date] <= IF(ISBLANK('All Cases'[Case Closed Date]), TODAY(), 'All Cases'[Case Closed Date]) &&
            'Date Table Static'[Is Business Day] = TRUE()
        )
    )
)-1

 

[SLA Result] compares the above number of days to the target, and assigns labels 'Pass' or 'Fail' if it the case was completed in time.

SLA Result = 
IF(
    ISBLANK(MAX('All Cases'[Case Closed Date])), 
    BLANK(), 
    IF(
        [E2E SLA] > MAX('All Cases'[SLA Target]),
        "Fail",
        "Pass"
    )
)

 

In the card visuals:-

[SLA Count Pass] is working perfectly.

SLA Count Pass = 
CALCULATE(
    COUNTROWS('All Cases'),
    FILTER(
        'All Cases',
        'All Cases'[SLA Result] = "Pass"
    )
)

 

[SLA Count Fail] returns 'Blank' even though there are 12 rows where the [SLA Result] is 'Fail'

SLA Count Fail = 
CALCULATE(
    COUNTROWS('All Cases'),
    FILTER(
        'All Cases',
        'All Cases'[SLA Result] = "Fail"
    )
)


I've tested everything I can think of, but it appears to be that whatever string is in the 1st position of the [SLA Result] measure, I can't count or filter by it ☹️

 

Any help greatly appreciated

2 REPLIES 2
v-zhengdxu-msft
Community Support
Community Support

Hi @vickyw 

 

Have you solved your problem? If so, can you share your solution here and mark the correct answer as a standard answer to help other members find it faster? Thank you very much for your kind cooperation!

 

Best Regards

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

v-zhengdxu-msft
Community Support
Community Support

Hi @vickyw 

 

There aren't any syntax error in this measure.
Actually that I create some sample data and test it, but unfortunately, the measure works fine in my side.

Please check if you apply some filter on the [SLA Result] measure?

If possible, please share your PBIX file(exclude sensitive data), so that we can help you better.

 

Best Regards

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

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.