Forum Discussion
Time Intelligence
- 9 years ago
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.
I think the trouble I'm having may be due to how my company's sales data works.
Each opportunity has a "Close Date" but it's projected or actual. So an opportunity can have a future close date with a status indicating it is "Pending" or it can have a past close date with a status of "closed" or "pending."
Does anyone think this could be messing things up?
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?
- bhmiller899 years agoHelper V
Could you possibly elaborate on the mismatch in dates?
- Sean9 years agoCommunity Champion
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!:smileyhappy:
- bhmiller899 years agoHelper V
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!