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
Anonymous
Not applicable

Dates on bar chart

Hi, I have a table with all sales from the previous 3 years with the date of the sale, the store number and more. I needed a measure that compared the sales of 2020 to the sales of 2019 so I did measure = (sales of 2020 - sales of 2019) / sales of 2019. This measure works fine in a table separated by the store number however when I want to graph it by month, the bar chart doesn't work and I believe it is because in my measure there are 2 dates: the date of the sale in 2019 and the date of the sale in 2020. 

 

I want my bar chart to have the date of sale in 2020 (just the month) on the x axis and the values to be (sale of Jan2020 - sales of year2019) / sales of year 2019 and so on for Feb, march.... Any ideas? (I dont want (jan2020 - jan2019)/jan2019)

 

Thank you

2 REPLIES 2
V-pazhen-msft
Community Support
Community Support

@Anonymous 

Not sure how is your model looks like, but you should have 1 date column only, something like.

DateSales

2019.1.1

1000
2019.1.22000
2019.1.32000
.......

2020.1.1

...

2020.1.2

...
.....

 

Then, you can aggregate or compare sales with some dax using measures.

Please provide a sample pbix or sample table that can describes your model.

 

Best regards

Paul Zheng _ Community Support Team

edhans
Super User
Super User

It sounds like you have a model issue. You should have one date column for sales, not one for 2019 and 2020. You will need to post some data so we can help. If you post a PBIX file, which is generally good, make sure to include the source data somehow - in Excel for example. I am thinking some of your columns need to be unpivoted so the dates can be put in a single column.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

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.