Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
uj91
Regular Visitor

Display last year and this year metric in area chart using field parameters

Based on a field parameter : 

PerOverview_Digital = {
    ("impressions", NAMEOF('Reporting.Digital'[Total Impressions_Digital]), 0),
    ("Clicks", NAMEOF('Reporting.Digital'[Total Clicks_Digital]), 1),
    ("Spend", NAMEOF('Reporting.Digital'[Total Media Cost_Digital]), 2),
    ("Video Starts", NAMEOF('Reporting.Digital'[Total Video Starts_Digital]), 3)
}

i want to comapre this year and last year (Measures from above parameter and used in a slicer) in a area chart visual. Impression taken as example in below visual which will change according to the parameter. 

uj91_0-1762771206520.png

Any suggestions help ? 



1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @uj91 ,

 

For this you need to combine your Field Parameters with Calculation group that will have the calculation for each of the lines.

 

Just create a new Calculation Group with two values:

Current Year = SELECTEDMEASURE()

Previous Year =CALCULATE (SELECTEDMEASURE(), DATEADD(Calendar[Date], -1, Year))

 

If you use this on the legend of your chart you should be able to get the expected result.

 

MFelix_0-1762775511741.png

 

MFelix_1-1762775522515.png

 

See an example attached.

 

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

Share the download link of the PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
MFelix
Super User
Super User

Hi @uj91 ,

 

For this you need to combine your Field Parameters with Calculation group that will have the calculation for each of the lines.

 

Just create a new Calculation Group with two values:

Current Year = SELECTEDMEASURE()

Previous Year =CALCULATE (SELECTEDMEASURE(), DATEADD(Calendar[Date], -1, Year))

 

If you use this on the legend of your chart you should be able to get the expected result.

 

MFelix_0-1762775511741.png

 

MFelix_1-1762775522515.png

 

See an example attached.

 

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



Hi @uj91 ,

Thank you for reaching out to the Microsoft Community Forum.

 

Hi @MFelix , Thank you for your prompt response.

 

Hi @uj91 , Could you please try the proposed solution shared by @MFelix  ? Let us know if you’re still facing the same issue we’ll be happy to assist you further.

 

Regards,

Dinesh

 

 

Hi @uj91 ,

We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. And, if you have any further query do let us know.

 

Regards,

Dinesh

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.