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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

Using FILTER by respecting other filter applied

Hi all, 

 

I'm using this formula to rank invoicing date within a month with some additional criteria. It works perfectly :

 

Rank number = 
    rankx(
        filter(
            filter(
                filter(
                    filter(
                        PNL,
                        EARLIER(PNL[Plant])=PNL[Plant]
                    ),
                    EARLIER(PNL[Invoice_year])=PNL[Invoice_year]
                ),
                EARLIER(PNL[Invoice_month])=PNL[Invoice_month]
            ),
            EARLIER(PNL[Div)=PNL[Div]
        ),
        PNL[Invoice_date].[Date],,,Dense
    )

 

In my table i have also a colum which tell me for each line if the invoice day is during week-ends or not. But this criteria is not inlcuded in the formula above. 

 

My final intention is to calculate the amount of the last X days of the month and i found how to do it. 

BUT :

I wanted to use this "weekend criteria" in my dashboard as a slicer for taking into account (or not) weekend invoices, and i thought that my Rank_number formula above was taking into account this slicer, but apparently it is not. In this formula, if my Xth last day of invoicing is a sunday, it will stay a sunday and the calculation will not taken into account in the sum, but I want this 7th day to be a friday in order to taken it into account. 

 

Any help on this maybe ? 

 

thank you

 

 

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , check if following columns in your date tbake can help

 

Work Day = if(WEEKDAY([Date],2)>=6,0,1)
Work Date = if(WEEKDAY([Date],2)>=6,BLANK(),[Date])
Work Date Cont = if([Work Day]=0,maxx(FILTER('Date',[Date]<EARLIER([Date]) && [Work Day]<> EARLIER([Work Day]) ),[Date]),[Date])
Work Date cont Rank = RANKX(ALL('Date'),[Work Date Cont],,ASC,Dense)
Work day of month = Sumx(filter(Date, [Month year] = earlier([Month year])),[Work Day])
Work day of week = Sumx(filter(Date, [Weekyear] = earlier([Weekyear])),[Work Day])

 

Traveling Across Workdays - What is next/previous Working day
https://community.powerbi.com/t5/Community-Blog/Travelling-Across-Workdays-Decoding-Date-and-Calendar-4-5-Power/ba-p/1187766

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

View solution in original post

2 REPLIES 2
v-deddai1-msft
Community Support
Community Support

Hi @Anonymous ,

 

You should use measure instead of calculated column if you want to take the slicer into account. Would you please show us some sample data and expected output by onedrive for business? Then we can help you more correctly.

 

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

 

Best Regards,

Dedmon Dai

amitchandak
Super User
Super User

@Anonymous , check if following columns in your date tbake can help

 

Work Day = if(WEEKDAY([Date],2)>=6,0,1)
Work Date = if(WEEKDAY([Date],2)>=6,BLANK(),[Date])
Work Date Cont = if([Work Day]=0,maxx(FILTER('Date',[Date]<EARLIER([Date]) && [Work Day]<> EARLIER([Work Day]) ),[Date]),[Date])
Work Date cont Rank = RANKX(ALL('Date'),[Work Date Cont],,ASC,Dense)
Work day of month = Sumx(filter(Date, [Month year] = earlier([Month year])),[Work Day])
Work day of week = Sumx(filter(Date, [Weekyear] = earlier([Weekyear])),[Work Day])

 

Traveling Across Workdays - What is next/previous Working day
https://community.powerbi.com/t5/Community-Blog/Travelling-Across-Workdays-Decoding-Date-and-Calendar-4-5-Power/ba-p/1187766

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 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.