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
Ailis
New Member

Clustered column & 2 lines with same series (TY & LY)

Hi,

 

I am new to Power BI and trying to create a report. I have an excel chart based on the same data (solid line = TY, dotted line = LY):

 

Excel goal 1.PNG

I am trying to replicate this in PowerBI. Currently my chart in PowerBI looks like this:

 

PowerBIPowerBI

I cant work out how to include a TY and LY line, rather than a line which is just the total of both. I am not sure if I need to pivot my data/create a measure/something else?

 

Currently to only show the line for a specific company I am filtering in the chart filters, but I may also eventually want to add multiple lines with other company TY data too, as below:

 

Excel goal 2.PNG

 

Many thanks!

 

1 ACCEPTED SOLUTION
v-haibl-msft
Employee
Employee

@Ailis

 

Yes, you need to create a measure. You can take a look at this article. I’ll also give a simple sample as below.

BTW, I’ve uploaded my .pbix file of following sample to here for reference.

Clustered column & 2 lines with same series (TY & LY)_1.jpg

For above dataset, we can create a measure with following DAX formula to get the last year sales.

The calendar table is related with above table using Date key.

LY_Sales = 
CALCULATE ( SUM ( Table1[Sales] ), SAMEPERIODLASTYEAR ( 'Calendar'[Date] ) )

Then in the line and clustered column chart, we can drag both LY_Sales and TY_Sales into Line values.

Clustered column & 2 lines with same series (TY & LY)_2.jpg

Best Regards,

Herbert

View solution in original post

1 REPLY 1
v-haibl-msft
Employee
Employee

@Ailis

 

Yes, you need to create a measure. You can take a look at this article. I’ll also give a simple sample as below.

BTW, I’ve uploaded my .pbix file of following sample to here for reference.

Clustered column & 2 lines with same series (TY & LY)_1.jpg

For above dataset, we can create a measure with following DAX formula to get the last year sales.

The calendar table is related with above table using Date key.

LY_Sales = 
CALCULATE ( SUM ( Table1[Sales] ), SAMEPERIODLASTYEAR ( 'Calendar'[Date] ) )

Then in the line and clustered column chart, we can drag both LY_Sales and TY_Sales into Line values.

Clustered column & 2 lines with same series (TY & LY)_2.jpg

Best Regards,

Herbert

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.