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
daveedd
Helper II
Helper II

Count number of days in a table using filters and all

Hey everyone,

 

I have 3 tables all related:

- Case Data = the data itself

- Date = a DAX table, just a list of days for visuals

- Holiday = a list of UK Bank Holidays 

 

I'm trying to create a measure that shows how many of each weekday, which was not a bank holiday, there has been in the last 6 months.  And return that same value for each individual day.

 

AKA I need these results (code below)

 

Screenshot 2022-04-06 at 15.59.12.png

to appear next to each weekday instead of 1.  IE every Monday should show 24, every Tuesday 25 etc

 

Screenshot 2022-04-06 at 16.01.43.png

and I would like filters applied to interact with it.

 

Here's my current code, not sure line 2 is actually doing anything for me.

 

calculate(countrows('Date'),

     format('Case Data'[Case Created], "DDD") = format('Case Data'[Case Created], "DDD") ,
     'Date'[Last 6 calendar months] = "True",
     Holidays[Type] <> "Bank Holiday")
 
1 ACCEPTED SOLUTION
v-janeyg-msft
Community Support
Community Support

Hi, @daveedd 

 

Since you didn't give a sample, we can't determine whether the columns and codes in your screenshot are columns or measures.

You can try:

CALCULATE (
    COUNTROWS ( 'Date' ),
    FILTER (
        ALL ( 'Date' ),
        'Date'[Last 6 calendar months] = "True"
            && Holidays[Type] <> "Bank Holiday"
            && 'Date'[Date of week] = SELECTEDVALUE ( 'Date'[Date of week] )
    )
)

 If it doesn't solve the problem, please provide us with what is the difference between the solution we gave you and what you want, so that we can modify it. Of course, if you can provide a sample, we will help you quickly and accurately.

Did I answer your question? Please mark my reply as solution. Thank you very much.
If not, please feel free to ask me.

Best Regards,
Community Support Team _ Janey

 

View solution in original post

8 REPLIES 8
v-janeyg-msft
Community Support
Community Support

Hi, @daveedd 

 

Since you didn't give a sample, we can't determine whether the columns and codes in your screenshot are columns or measures.

You can try:

CALCULATE (
    COUNTROWS ( 'Date' ),
    FILTER (
        ALL ( 'Date' ),
        'Date'[Last 6 calendar months] = "True"
            && Holidays[Type] <> "Bank Holiday"
            && 'Date'[Date of week] = SELECTEDVALUE ( 'Date'[Date of week] )
    )
)

 If it doesn't solve the problem, please provide us with what is the difference between the solution we gave you and what you want, so that we can modify it. Of course, if you can provide a sample, we will help you quickly and accurately.

Did I answer your question? Please mark my reply as solution. Thank you very much.
If not, please feel free to ask me.

Best Regards,
Community Support Team _ Janey

 

v-janeyg-msft
Community Support
Community Support

Hi, @daveedd 

 

Have you problem been solved? If yes, you can mark the helpful answer as solution to close the thread. If not, please feel free to ask me.

 

Best Regards,
Community Support Team _ Janey

Hi, no I'm afraid the kind suggestions people have made didn't work and I still haven't managed to crack it

Can you please share pbix after hiding sensitive data?

Cheers,
Shishir
Shishir22
Solution Sage
Solution Sage

Hello @daveedd ,


Please try creating measure something like - 

WorkingDay = 
Calculate(COUNTX(Filter(Data,[HolidayType]<>"Bank Holiday"),Data[Date]),ALLEXCEPT(Data,Data[Day of week]))

 Also, in table visual please change the date column to date from herirachy -

 

Shishir22_0-1649318226318.png

 

Please mark it as solution of it solves your requirement. Kudos are also appreciated.

 

Cheers,

Shishir

 

 

 

Cheers,
Shishir
johnt75
Super User
Super User

replace the 2nd line with

REMOVEFILTERS('Date'),

Afraid that just makes everything say the total number of days rather than the number of times each weekday appears

 

Screenshot 2022-04-07 at 08.09.45.png

Yes, of course. Try instead

ALLEXCEPT( 'Date'[Day of week])

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Top Solution Authors