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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
bjurek
Helper I
Helper I

Calculate in row

Hello!

 

Anybody knows how calculate "How many times in a row there is no availability counted from the last date"

 

bjurek_0-1679584235867.png

 

3 REPLIES 3
FreemanZ
Super User
Super User

hi @bjurek 

try to add a calculated column like:

Column = 
VAR _currentdate = tbl[Date]
VAR _table = FILTER(tbl, tbl[Shop]=EARLIER(tbl[Shop]))
VAR _stopdate =
MAXX(
    FILTER(
        _table,
        tbl[Date]<_currentdate
            &&tbl[value]=1
    ),
    tbl[Date]
)
VAR RESULT=
IF(
    tbl[Value]=0&&tbl[Date]=MAXX(_table, tbl[date]),
    COUNTROWS(
        FILTER(
           _table,
            tbl[Date]<=_currentdate
                &&tbl[Date]>_stopdate
        )
    ),
    BLANK()    
)
RETURN RESULT

 

it worked like:

FreemanZ_0-1680927151004.png

amitchandak
Super User
Super User

@bjurek , if you need a new column

 

if([Date] = maxx(filter(Table, [Shop] = earlier([Shop])), [Date]) , Countx(filter(Table, [Shop] = earlier([Shop]) && [availability] =0 ), [Date]) , blank())

 

for measures

 

if(MAx([Date]) = maxx(filter(allselected(Table), [Shop] = max([Shop])), [Date]) , Countx(filter(allselected(Table), [Shop] = Max([Shop]) && [availability] =0 ), [Date]) , blank())

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak 

 

Hi, thanks for help, however its not work. Instead show value 8 it show 13 = (8+5 from 2023-01-01 to 2023-01-10)

 

Can you check ? 

 

 

bjurek_0-1680606349254.png

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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