Forum Discussion
Merge date into graph with correct dates
Hi all,
Im totally new to Power BI, and just playing arround with it. My use case is this:
Whenever I fill up my car at the gas station, I note the amound of KM's I drove. Together with the liters of gas, my gas consumption is being calculated, and stored into a CSV file together with the date.
I've imported this CSV to Power BI, and created a spark line looking like this:
Now just for the fun of it, I would like to compare this to the weather data. The windspeed for example. This wasn't to hard, and I managed to get the weather data from a txt file into Power BI. But I doesn't seem to recognize the date stamps or something.
The reason that I suspect that the Windspeed Dates aren't recognised, is because it doesn't matter if I add, or delete that to the graphic. The line stays the same. It looke like this:
I hope I managed to explain my problem, and if there are any ideas how to solve this.
Thanks in advance!
5 Replies
- WorlockNew Member
BTW, the date are in a different format.
ConsumptionDate = DD-M-YYYY
WindspeedDate = YYYMMDD
- amitchandakSuper User
You can convert both to dates like this if power bi has not detected these as dates
ConsumptionDate = DD-M-YYYY
Date = date(right([ConsumptionDate],4),mid([ConsumptionDate],4,1),left([ConsumptionDate],2)
in case there are to MM in between
Date = date(right([ConsumptionDate],4),mid([ConsumptionDate],4,2),left([ConsumptionDate],2)
WindspeedDate = YYYMMDD
Date = date(left([ConsumptionDate],3),mid([ConsumptionDate],4,2),right([ConsumptionDate],2)
or
Date = date(Mid([ConsumptionDate],1,2),mid([ConsumptionDate],5,2),right([ConsumptionDate],2)
in case there 4 YYYY
Date = date(left([ConsumptionDate],4),mid([ConsumptionDate],5,2),right([ConsumptionDate],2)
Join both of them with common date dim
- v-lionel-msftCommunity Support
Hi Worlock ,
The reason your chart looks like this is because the Axis don't match the Values.
If you have two tables, they represent gasoline consumption and weather.
You can use the date columns in the two tables to create relationships, and then use any of the date columns to create visualizations.
(Also, make sure both date columns are in date type.)
Best regards,
Lionel ChenIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- WorlockNew Member
So. do I need to create 2 tables and then a relationship? Or within 1 table?
Also, I can't specify a data type, it's greyed out.- v-lionel-msftCommunity Support
Hi Worlock ,
I don't know much about your data model, please show me a sample data model.
Best regards,
Lionel ChenIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.