Forum Discussion
Help with Line Chart
Hi,
I'm trying to create a line chart to compare the number of Volume create against the numbers of volume sold to customers (Depletion in my sample file) for 2 products - Pinot Grigio and Premium Red Wine.
I created relationships and they seem to be ok with one to many's.
However when I drag the data in the USA 9LE or volume seems ok but the Depletion 9LE is all the same number for Pinot Grigio and showing nothing for Premium Red Wine even though there should be data - Sample data in my screenshot below:
I want to create an accurate line chart to compare the US 9LE against the Depletion 9LE - example below but dark blue line needs to be different too:
Can anybody help me in achieving this? I've attached the sample PBI file below and also the Excel file I created to make this graph.
PBI File - https://drive.google.com/file/d/1xa9DqZ6Ck1YSook6a4zWVDa8yYCQjKFE/view?usp=drive_link
Any help would be greatly appreciated.
hi gbarr12345 ,
this link has the code with variable start and end date:
avixd/CalendarTable_with_DAX: Code samples of a calendar table using DAX (github.com)
Change what is highlighted in yellow for the output:
8 Replies
- adudaniMemorable Member
hi gbarr12345 ,
Attached is my solution and an image of the output. Let me know if this meets the requirements.
steps taken:
1. added a date table.
2. Create 1 to many relationships from dimensions to facts.
3. Used the date from the date table instead of the depleation/usa table.
- gbarr12345Post Prodigy
Thank you for your response.
How did you create the date table do you mind me asking?
- adudaniMemorable Member
hi gbarr12345 ,
references below have open source code.
using dax, you could create a new table and copy paste the dax code. Walk throughs of the code is in the videos.
Here is how to make it via DAX: Calendar Table using DAX (youtube.com)
Using a blank query, copy paste the code into the advanced editor in power query:
Power BI Ultimate Calendar Table 🗓️ / Date Table 📆 [ FREE DOWNLOAD ] (youtube.com)