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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Measure transformation from varying on all dates to lastdate of the month

Dear all,

 

I hope you are well.

 

I have three different tables:

- A calendar table;

- A visitors table with the logins, one row represents one login.

 

I calculate the Weekly Active Users (WAU). The formula I use requires me to compute it for each date, like that:

 

araignee_0-1647946635764.png

 

I would need to have the WAU as measure for the very last date of the period and not depending on/for each date, so, one datapoint for each month.

 

Here is the original formula:

 

WAU =

var currentDate = SELECTEDVALUE('calendar'[Date])
var date7DaysAgo = FIRSTDATE(DATEADD('calendar'[Date], -7, DAY))

RETURN
CALCULATE(
DISTINCTCOUNT('Visitors'[Visitor ID])
,'calendar'[Date] <=currentDate,
'calendar'[Date] > date7DaysAgo)

 

Thank you in advance for your help! I appreciate it.

 

I am at your disposal should you have any questions.

 

A

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , for that you need a measure like

 

MTD Sales = CALCULATE(lastnonblankvalues('Date'[Date],DISTINCTCOUNT('Visitors'[Visitor ID])) ,DATESMTD('Date'[Date]))

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

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , for that you need a measure like

 

MTD Sales = CALCULATE(lastnonblankvalues('Date'[Date],DISTINCTCOUNT('Visitors'[Visitor ID])) ,DATESMTD('Date'[Date]))

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
Anonymous
Not applicable

I would need to keep the base formula the same as it is a metric.

Anonymous
Not applicable

I worked around it, it works! I did not know the function LASTNONBLANKVALUE.

 

Thank you amitchandak! You are an angel!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.