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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

count the number of completed days in a month

Hi, 

 

I have a fact table with data from the entire year. 

 

I want to show the percentage of the month that is completed.

 

i.e: 

 

January is 100% 

February is 100%

March is 100% 

April is 100%

May is 100% 

June is 100%

July is 97% 

 

I've created this measure to get my denominator:

 

EOMonth = day(ENDOFMONTH(DateDimension[Date]))

 

But I need a way to count the number of days in the selected month, based on the current date. 

 

- My fact table has a last date of today(). 

- I want to show that all the previous months are 100% complete, and show progress of current month. 

 

Any help?

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

@Anonymous

 

Try this MEASURE

 

Measure =
VAR lastmonth =
    CALCULATE ( MONTH ( LASTDATE ( FactTable[Date] ) ), ALL ( FactTable ) )
VAR last_date =
    CALCULATE ( DAY ( LASTDATE ( FactTable[Date] ) ), ALL ( FactTable ) )
RETURN
    IF (
        SELECTEDVALUE ( DateDimension[Date].[MonthNo] ) = lastmonth,
        DIVIDE ( last_date, [EOMonth] ),
        1
    )

Regards
Zubair

Please try my custom visuals

View solution in original post

1 REPLY 1
Zubair_Muhammad
Community Champion
Community Champion

@Anonymous

 

Try this MEASURE

 

Measure =
VAR lastmonth =
    CALCULATE ( MONTH ( LASTDATE ( FactTable[Date] ) ), ALL ( FactTable ) )
VAR last_date =
    CALCULATE ( DAY ( LASTDATE ( FactTable[Date] ) ), ALL ( FactTable ) )
RETURN
    IF (
        SELECTEDVALUE ( DateDimension[Date].[MonthNo] ) = lastmonth,
        DIVIDE ( last_date, [EOMonth] ),
        1
    )

Regards
Zubair

Please try my custom visuals

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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