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
saadat_rda
Frequent Visitor

Showing two years of financial data on same graph

Hi ,

 

I would like to show  YTD revenue figures for this year, last year and target on the same line chart.

When I try to pull last year data, PowerBI treats it as one continuous dataset as all dates are coming from a date table.

 

This is what I have. I just

saadat_rda_1-1679626823637.png

 

the DAX used to calculate YTD values is:

YTD_Billed = CALCULATE(SUM(FY23[InvoiceAmount]),DATESYTD('Fiscal Year Table'[Date],"06/30"))
YTD_Billed22 = CALCULATE(SUM(FY22[InvoiceAmount]),DATESYTD('Fiscal Year Table'[Date],"06/30"))
Target YTD = CALCULATE([Target],DATESYTD('Fiscal Year Table'[Date],"06/30"))
 
How can I show the graphs overlapping each other instead of a coninuous time frame as showin in my graph?
 

Please note, I am operating in direct query mode hence calcualted columns are not an option for me.

 

3 REPLIES 3
saadat_rda
Frequent Visitor

@rajulshah almost but not quite there.

 

The DAX you provided results in the billow visual.

I think this is because the revenue for each year resides in two seperate tables.

So i have a table called FY23 and another called FY22. I think the sameperiodlastyear function checks for datafrom the last year in FY23 table, except there isn't any? and for some reason it's spitting it out as FY24 instead.

 

saadat_rda_0-1679646011852.png

 

Not sure, that could be the reason.

rajulshah
Super User
Super User

@saadat_rda 

 

You can create a measure as follows:

YTD_Billed22 = CALCULATE ( [YTD_Billed] , SAMEPERIODLASTYEAR ( 'Fiscal Year Table' [ Date ] ) )

Please let me know if this didn't work.

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.