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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Anonymous
Not applicable

Measure not displaying full amount

Hi,

 

I am trying to display the number of weekdays for each month but the selecting filter is not working

In the screenshot below, when I select Apr, it correctly shows the April numbers, but when not selecting any month, it does not show the sum of days from Jan-Jun

Capture2.PNG     Capture.PNG

 

The measure I am using to find the "Count Weekday" is : 

Count Weekday Official = average(CP_Consolidated[DayCount])
 
The column formula I am using to find number of days in a month is :
DayCount =
VAR __monthstart =
EOMONTH ( CP_Consolidated[Date], -1 ) + 1
VAR __monthend =
EOMONTH ( CP_Consolidated[Date], 0 )
VAR __minthisemploye =
CALCULATE ( MIN ( CP_Consolidated[Date]), ALLEXCEPT ( CP_Consolidated,CP_Consolidated[Crew#] ) )
RETURN
IF (
ISBLANK (
CALCULATE (
COUNTROWS ( CP_Consolidated ),
ALLEXCEPT ( CP_Consolidated,CP_Consolidated[Crew#] ),
CP_Consolidated[Date] < __monthstart
)
),
DATEDIFF ( __minthisemploye, __monthend, DAY ),
DATEDIFF ( __monthstart, __monthend, DAY ) + 1
)
 
Is there a way so that when I do not select any month, the sum of days from Jan-Jun correctly are displayed?
 
Please let me know if this question does not make sense
 
Thank you!
Sarah
1 ACCEPTED SOLUTION
v-eachen-msft
Community Support
Community Support

Hi @Anonymous ,

 

You could create a measure to get the slicer status. If the result returns blank, you could make it return the sum of all months.

Measure =
VAR a =
    SELECTEDVALUE ( 'Slicer'[Month] )
RETURN
    IF (
        ISBLANK ( a ),
        SUMX ( ALLSELECTED ( 'Table'[Month] ), [Count Weekday Official] ),
        [Count Weekday Official]
    )

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

6 REPLIES 6
v-eachen-msft
Community Support
Community Support

Hi @Anonymous ,

 

You could create a measure to get the slicer status. If the result returns blank, you could make it return the sum of all months.

Measure =
VAR a =
    SELECTEDVALUE ( 'Slicer'[Month] )
RETURN
    IF (
        ISBLANK ( a ),
        SUMX ( ALLSELECTED ( 'Table'[Month] ), [Count Weekday Official] ),
        [Count Weekday Official]
    )

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.
aj1973
Community Champion
Community Champion

Hi @Anonymous 

In your date Table create a Column for the workdays 

WorkingDay_Mark =
VAR WeekDayNum =
WEEKDAY ( DimDate[Date] )
RETURN
(
IF ( WeekDayNum = 1 || WeekDayNum = 7 ,0,1)
)
the use a slicer for the dates and a Card for your weekdays
Weekdays.PNGWorking days.PNG
Regards

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Anonymous
Not applicable

thank you, all!

but my main question is how to get the correct total number of days between jan and jun if no dates are selected in my filter

 

 

Thank you!
Sarah

aj1973
Community Champion
Community Champion

@Anonymous 

Change the date slicer to view it 'Between' or 'relative dates'

DatesBetween.PNG

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

amitchandak
Super User
Super User

@Anonymous , you can create a workday column in date table and sum it up

 

Workday= if(WEEKDAY([Date],2)<6,1,0)

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

Hi,

 

Can you try below measure to calculate count of week days?

 

Weekday_Check =
CALCULATE (
COUNTROWS ( 'Table' ),
FILTER ( ALL ( 'Table'[Date] ), WEEKDAY ( 'Table'[Date], 2 ) < 6 )
)

 

Appreciate a Kudos! 🙂
If this helps and resolves the issue, please mark it as a Solution! 🙂

Regards,
N V Durga Prasad

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors