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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Wonderweme
New Member

Compute Rates For The Last Day In The Month

I'm fairly new to DAX, so I think there's an easy way to do this, and I'm just not seeing it. Our organization launched a wellness campaign last year, and we want to build a dashboard to monitor current utilization and track trends from the previous year. Participants are asked to log baseline vital signs each calendar year in a portal. I receive weekly data reports that list all participants and their login status. It's a rolling report, and once someone becomes compliant for logging in, they remain so for the remainder of the year. I know how to identify the most recent reporting period with the MAX function. However, I want to track MoM compliance and use only the last report of each month, as it reflects the most complete data for that period. I just can't figure out the best way to go about it. I am going to sum my numerator (Logged In) and Denominator columns and divide to get the compliance rate (perhaps SUMX would be better here). How would I build a measure that only calculates for the latest day of each month?

 

In my example below, 4 employees are participating in this program. Each weekly report shows whether they logged in; once they have, they remain marked as compliant for each subsequent reporting period. I want to calculate the compliance rate to reflect the following:

MonthRate
January 202525%

February 2025

50%
March 202575%
April 2025100%

 

 

Employee IDReportDateLogins (Numerator)Program Participant (Denominator)
123451/6/202501
678901/6/202501
543211/6/202501
987601/6/202501
123451/13/202511
678901/13/202501
543211/13/202501
987601/13/202501
123451/20/202511
678901/20/202501
543211/20/202501
987601/20/202501
123451/27/202511
678901/27/202501
543211/27/202501
987601/27/202501
123452/3/202511
678902/3/202501
543212/3/202501
987602/3/202511
123452/10/202511
678902/10/202501
543212/10/202501
987602/10/202511
123452/17/202511
678902/17/202501
543212/17/202501
987602/17/202511
123452/24/202511
678902/24/202501
543212/24/202501
987602/24/202511
123453/3/202511
678903/3/202501
543213/3/202511
987603/3/202511
123453/10/202511
678903/10/202501
543213/10/202511
987603/10/202511
123453/17/202511
678903/17/202501
543213/17/202511
987603/17/202511
123453/24/202511
678903/24/202501
543213/24/202511
987603/24/202511
123453/31/202511
678903/31/202501
543213/31/202511
987603/31/202511
123454/7/202511
678904/7/202501
543214/7/202511
987604/7/202511
123454/14/202511
678904/14/202501
543214/14/202511
987604/14/202511
123454/21/202511
678904/21/202511
543214/21/202511
987604/21/202511
123454/28/202511
678904/28/202511
543214/28/202511
987604/28/202511
4 REPLIES 4
ryan_mayu
Super User
Super User

@Wonderweme 

you can create  month column

Month = FORMAT('Table'[ReportDate],"mmm")
month order = month('Table'[ReportDate])
and sort month by month order
 
then create a measure
 
Measure =
DIVIDE (
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[Employee ID] ),
        'Table'[Logins (Numerator)] = 1
    ),
    DISTINCTCOUNT ( 'Table'[Employee ID] )
)
 
11.png

 

 

pls see the attachment below





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Ashish_Mathur
Super User
Super User

Hi,

Can the last 2 columns of the second table be treated as input columns i.e. are they given?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
cengizhanarslan
Memorable Member
Memorable Member

1) Last report date in the current month context

Last Report Date (Month) =
CALCULATE (
    MAX ( Fact[ReportDate] ),
    ALLEXCEPT ( 'Date', 'Date'[Year], 'Date'[Month] )
)

This returns the latest reporting date for the month shown in a Month/Year visual.

 

2) Compliance rate at the last report of the month

Compliance Rate (Month End) =
VAR LastDt =
    [Last Report Date (Month)]
VAR Num =
    CALCULATE (
        SUM ( Fact[Logins] ),
        Fact[ReportDate] = LastDt
    )
VAR Den =
    CALCULATE (
        SUM ( Fact[Program Participant] ),
        Fact[ReportDate] = LastDt
    )
RETURN
DIVIDE ( Num, Den )
 Put Date[Month] / Date[Year] on rows (or axis) and use this measure.
 
_________________________________________________________
If this helped, ✓ Mark as Solution | Kudos appreciated
Connect on LinkedIn
amitchandak
Super User
Super User

@Wonderweme , Assume you have Rate measure and Date table. You can measure that will use last non blank rate 

Calculate(lastnonblankvalue(Table[Date], [Rate Measure]))


Calculate(lastnonblankvalue(Table[Date], [Rate Measure]), filter( all('Date'), 'Date'[Month Year] = max( 'Date'[Month Year])))


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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.