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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
AlanP514
Post Patron
Post Patron

Dynamic Weekly total triggering failure KPI

Hi all, 
I have a requirement, Please help me to achieve this task
I have a requirement, I am working on the azure data, in one day many triggers will happen(Refreshing, adding new data)
so, by default, i filtered based on the last 2 weeks' data like this 

AlanP514_0-1659944182527.png
Task is. i want to create one KPI Card to find out weekly how many trigger failures happened 

AlanP514_1-1659944280558.png
Based on the 0 values we can find how many triggers is failed during the last 2 weeks
Can anyone please help me to find out this solution?


 



 

1 ACCEPTED SOLUTION
memepu
Resolver II
Resolver II

Hi @AlanP514 ,

I have created a simple sample, please refer to it to see if it helps you.

Dynamic Weekly total triggering failure KPI.pbix

Measure =
VAR _this =
    WEEKNUM ( TODAY (), 2 )
VAR _before2week = _this - 2
VAR _count =
    CALCULATE (
        COUNT ( Sheet1[Bronze] ),
        FILTER (
            ALL ( Sheet1 ),
            Sheet1[Bronze] = 0
                && Sheet1[weeknum] >= _before2week
                && Sheet1[weeknum] <= _this
        )
    )
RETURN
    IF (
        MAX ( Sheet1[weeknum] ) >= _before2week
            && MAX ( Sheet1[weeknum] ) <= _this,
        _count,
        BLANK ()
    )

memepu_0-1660110100112.png

If I have misunderstood your meaning, please provide more details with your desired output.

 

Best regards.

 

View solution in original post

2 REPLIES 2
memepu
Resolver II
Resolver II

Hi @AlanP514 ,

I have created a simple sample, please refer to it to see if it helps you.

Dynamic Weekly total triggering failure KPI.pbix

Measure =
VAR _this =
    WEEKNUM ( TODAY (), 2 )
VAR _before2week = _this - 2
VAR _count =
    CALCULATE (
        COUNT ( Sheet1[Bronze] ),
        FILTER (
            ALL ( Sheet1 ),
            Sheet1[Bronze] = 0
                && Sheet1[weeknum] >= _before2week
                && Sheet1[weeknum] <= _this
        )
    )
RETURN
    IF (
        MAX ( Sheet1[weeknum] ) >= _before2week
            && MAX ( Sheet1[weeknum] ) <= _this,
        _count,
        BLANK ()
    )

memepu_0-1660110100112.png

If I have misunderstood your meaning, please provide more details with your desired output.

 

Best regards.

 

amitchandak
Super User
Super User

@AlanP514 , With help from separate week/date table and week rank, you find that

 

example

the new column needs in date/week table

 

 

measures

Last 2 weeks = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]>=max('Date'[Week Rank])-2 && 'Date'[Week Rank]<=max('Date'[Week Rank])))

 

or

 

Last 2 weeks =
var _max1 = maxx(allselected('Table'), 'Table'[date])
var _max = maxx(filter(all(date), date[date] = _max1), week[Rank])
return
CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]>=_max-2 && 'Date'[Week Rank]<=_max))

This Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])))
Last Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1))

 

Week Rank = RANKX(all('Date'),'Date'[Week Start date],,ASC,Dense)
OR
Week Rank = RANKX(all('Date'),'Date'[Year Week],,ASC,Dense) //YYYYWW format

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors