cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper V
Helper V

Time Intelligence

Having an issue with my time intelligence calculations.  I calculated "SalesYTD," "SalesMTD," and "LastMonthSales."

 

For some reason it's including December 2016 in the YTD sales and doesn't appear to be accurately calculating "LastMonthSales" 

 

I used:

 

LastMonthSales$ = CALCULATE([TotalServices$], PARALLELPERIOD('Calendar'[Date], -1, MONTH))

 

MTDSales$ = TOTALMTD([TotalServices$], 'Calendar'[Date])

 

YTDSales$ = TOTALYTD([TotalServices$], 'Calendar'[Date])

Capture.JPG

 

 

 

 

15 REPLIES 15

Your data model is quite complex, so I haven't attempted to trace the calculations through...but if you filter your sales measures on "closed" opportunities, then that should work ok.

 

There is some mismatch between your date field in the DimDate table and CloseDate field in the "dpmgr..." table though - even though there is an active relationship between them. And since your sales measures (Sales$MTD, Sales$YTD, etc.) use the DimDate[Date] field, that may be causing some of the issues.

 

Perhaps try parsing out the date from the date/time CloseDate field and using just the date in your relationship? 

Could you possibly elaborate on the mismatch in dates?

Community Champion
Community Champion

@bhmiller89

 

Look at my response here and the pictures...

http://community.powerbi.com/t5/Desktop/Count-by-Category/m-p/83368#U83368

The example is different but you'll see what happens when you use different dates!

 

hope this helps.

Good Luck!Smiley Happy

@Sean ah I see. I made a table including the datekey (dimdate) column and the close date column and one is completely blank where the other isn't.

 

I'm just not getting it at all, can't seem to figure this stuff out. Thanks for you help, I'm just going to throw in the towel!

Community Champion
Community Champion

@bhmiller89

Okay I understand!

If you decide to revist this at a later time check out this post by @MattAllington

http://exceleratorbi.com.au/multiple-relationships-between-tables-in-dax/

He uses an example with Ship Date and Order Date

Good Luck! Smiley Happy

You are probably closer than you realize, so I will just throw this out there. 

 

Thinking about the dates as numbers it might help... 

 

If you have a value of '1 January 2017' in the DimDate table, it is represented as the number 42736. But if you have a value of '1 January 2017, 13:46' in the CloseDate field, it is represented as 42736.57 (you can check this in Excel by entering these values, then formatting the cell as a number).

 

If you have a relationship between these two fields, Power BI thinks that the values above do not match. That makes sense to a computer, because they are different numbers. That's why one column is blank while the other isn't when you add them to a table. But you want Power BI to assume that everything that happened on 1 January 2017 should be linked (regardless of the time it happened on that day). 

 

So you can try this:

 

1. click on edit queries

2. expand and click on the CloseDate column

3. click the Add column tab

4. Click the Date button and select 'Date Only'

 

This will add a new column that contains only dates (no times). Use that new date-only field in your measures, etc. and see if that helps. 

 

View solution in original post

Helpful resources

Announcements
November Update

Check it Out!

Click here to read more about the November 2020 Updates!

Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

secondImage

Power Platform October Community Highlights

Check out the top community contributors across all of the communities

secondImage

Create an end-to-end data and analytics solution

Learn how Power BI works with the latest Azure data and analytics innovations at the digital event with Microsoft CEO Satya Nadella.

Top Solution Authors
Top Kudoed Authors