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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Determining How Many Days Since Last error

Hi Everyone,

 

I have below columns

1.Source,  2. This week Num of days without errors & Week of year column column. i want number of days without error.

In Below column for source CFDI all fives days in week-10, week-9, week-8 there was no error so number of days without error will be 15 but for FEX it has to be 9 because i have received error on day 1 of week 9 so it has to caliculate last 4 days of week9 (which doesn't have any error) and 5 days of week 10 (which doesn't have any error) how can i achive this  
 Capture_03_1.PNG

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

I updated my sample pbix file(see attachment), please check whether that is what you want.

Measure =
VAR _week =
CALCULATE (
MAX ( 'Table'[Week of Year] ),
FILTER (
'Table',
'Table'[Source] = SELECTEDVALUE ( 'Table'[Source] )
&&'Table'[Year]=SELECTEDVALUE('Table'[Year])
&& 'Table'[Days of week] < 5
)
)
VAR _days =
CALCULATE ( SUM ( 'Table'[Days of week] ) )
VAR _days1 =
CALCULATE (
SUM ( 'Table'[Days of week] ),
FILTER (
'Table',
'Table'[Source] = SELECTEDVALUE ( 'Table'[Source] )
&&'Table'[Year]=SELECTEDVALUE('Table'[Year])
&& 'Table'[Week of Year]
>= _week
)
)
RETURN
IF ( ISBLANK ( _week ), _days, _days1 )

 

Measure 2 = SUMX(VALUES('Table'[Source]),SUMX(VALUES('Table'[Year]),[Measure]))

yingyinr_0-1615352493880.png

Best Regards

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi @Anonymous ,

I created a sample pbix file(see attachment), please check whether that is what you want.

Determining How Many Days Since Last error.JPG

Best Regards

Anonymous
Not applicable

Hi @Anonymous  Thanks for the reply 
I have date and week columns in my data. Days of Week column represents number of days without error in that week trying with ur measure but i am getting error i mean values i am geeting is 115 instead of 15  

abhilash_patel_0-1614866077557.png

 

Anonymous
Not applicable

Hi @Anonymous ,

I just add date and week columns in my source data, it works well base on original measures... Could you please provide your sample pbix file with my measure(exclude sensitive data) and the formula if the field Days of Week is from measure or calculated column? By the way, whether include the data from different year? I want to make troubleshooting and find the cause to get the solution base on your scenario. Thank you.

Determining How Many Days Since Last error_2.JPG

Best Regards

Anonymous
Not applicable

@Anonymous  Thansk for the soultion this worked for me. here i have only one year (2021) values. any idea if i have more that one year of data ...? 

Anonymous
Not applicable

Hi @Anonymous ,

I updated my sample pbix file(see attachment), please check whether that is what you want.

Measure =
VAR _week =
CALCULATE (
MAX ( 'Table'[Week of Year] ),
FILTER (
'Table',
'Table'[Source] = SELECTEDVALUE ( 'Table'[Source] )
&&'Table'[Year]=SELECTEDVALUE('Table'[Year])
&& 'Table'[Days of week] < 5
)
)
VAR _days =
CALCULATE ( SUM ( 'Table'[Days of week] ) )
VAR _days1 =
CALCULATE (
SUM ( 'Table'[Days of week] ),
FILTER (
'Table',
'Table'[Source] = SELECTEDVALUE ( 'Table'[Source] )
&&'Table'[Year]=SELECTEDVALUE('Table'[Year])
&& 'Table'[Week of Year]
>= _week
)
)
RETURN
IF ( ISBLANK ( _week ), _days, _days1 )

 

Measure 2 = SUMX(VALUES('Table'[Source]),SUMX(VALUES('Table'[Year]),[Measure]))

yingyinr_0-1615352493880.png

Best Regards

Anonymous
Not applicable

@Anonymous Thank you this is working

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.