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
jamezcua9
Helper I
Helper I

Power BI Desktop DATESMTD Measure

Hello,

I'm fairly new to Power BI and currently using PBI Desktop to develope and publish.  I'm having trouble with a measure that is not calculating the date corretly.  I have 2 queries with a relationship connected together.  

 

This is my measure : 

MonthTarget = CALCULATE(SUM('Cluster Plan'[AVERAGE_PER_DAY_US]),DATESMTD('Cluster Plan'[PLAN_DATE]),FILTER('Cluster Plan','Cluster Plan'[CLUSTER_PLAN_DATE]<TODAY()))
 
Since we now switched over to March 2019, the measure is calculating the same target KPI on every single date. 
Any idea on how I can accomplish the correct measure total based on the date/month?  
2019-03-04_10-20-26.jpg

 

2 ACCEPTED SOLUTIONS
bogomda
Helper II
Helper II

DATESMTD resets counting every month. you probably don't have any records  for "Cluster Plan"[AVERAGE_PER_DAY_US] for months of March yet.

 

Another problem could be that DATESMTD is not applied to calendar table (table which is related to fact table with dates starting from Jan 1 through Dec 31 and daily granularity).

 

without seeing that model it's hard to fix the problem.

View solution in original post

v-chuncz-msft
Community Support
Community Support

@jamezcua9 ,

 

For any time intelligence function, you could implement a custom DAX formula.

https://www.sqlbi.com/articles/time-intelligence-in-power-bi-desktop/

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

View solution in original post

5 REPLIES 5
v-chuncz-msft
Community Support
Community Support

@jamezcua9 ,

 

For any time intelligence function, you could implement a custom DAX formula.

https://www.sqlbi.com/articles/time-intelligence-in-power-bi-desktop/

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
bogomda
Helper II
Helper II

DATESMTD resets counting every month. you probably don't have any records  for "Cluster Plan"[AVERAGE_PER_DAY_US] for months of March yet.

 

Another problem could be that DATESMTD is not applied to calendar table (table which is related to fact table with dates starting from Jan 1 through Dec 31 and daily granularity).

 

without seeing that model it's hard to fix the problem.

I just added the Fact table DimCalendar. 

My cluster plan tables does not have every day granualarity, but does have YYYYWW column in common.  Still it does not give me what I need.  

it will be hard to fix your issue not seeing sample model.

Greg_Deckler
Super User
Super User

See if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.