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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register 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]))

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]))

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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