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
Muertepelá
Frequent Visitor

Comparing data in differents period of time at same line chart

Dear all, 

I am strugguling to compare different periods of time. 

I would like compare values from different periods of time, in order to visualize esaier, I would like use a line chart adn for each period of time share the same origin at the line chart. 

Any idea how could I do it?

 

I put a picture to shown the idea. In the picture there are 6 cycles that I would like put all together in a line chart , with the same origin at X axis.

 

Any idea or solution , it will be apreciated. 

 

Regards

Captura.JPG

 

The original data table is something like this:

TimeValue
30/09/2014 0:000,15021051
01/10/2014 0:000,15194218
02/10/2014 0:000,16627039
03/10/2014 0:000,15699187
04/10/2014 0:000,15448058
05/10/2014 0:000,16861516
06/10/2014 0:000,18285625
07/10/2014 0:000,18062967
08/10/2014 0:000,1817147
11/10/2014 0:000,1834853
17/10/2014 0:000,17345996
18/10/2014 0:000,17069541
19/10/2014 0:000,17165352
20/10/2014 0:000,17774116
21/10/2014 0:000,17316929

 

1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @Muertepelá ,

 

If say, you want to compare the lines by year, you can put year to the legend field and remove it from x-axis.

 










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Muertepelá , You can plot two-period together on a line chart, for that the compared period should be trailing measure.

Like you can plot a YTD and LYTD where LYTD will appear on the same range as you YTD. Or you can have a trailing measures. This measure can 1 day, 1month 5 days , 7 days , 1 year, 2 years behind. You can configure and will appear along with your main measure. This work beast with a date calendar

Examples

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(('Date'[Date]),"12/31"))
This Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD((ENDOFYEAR('Date'[Date])),"12/31"))

Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
Last YTD complete Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
Last to last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))

Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))
Year + 3 week behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd(dateadd('Date'[Date],-1,Year),-21,Day))
55 weeks behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],365+12,Day))

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

 

 

danextian
Super User
Super User

Hi @Muertepelá ,

 

If say, you want to compare the lines by year, you can put year to the legend field and remove it from x-axis.

 










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
edhans
Super User
Super User

You need a date table, then you drop the Year into the X Axis and it will allow you to see the months overlapping. Date tables are explained here. Instructions for creating a date table in Power Query can be found here. That date table will automatgically expand as your data does.

 

If you need additional help, we'd need some data, preferably a PBIX file to pay with that has dummy data in it.

 



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.