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
Bastienlin_
Helper II
Helper II

Show a column and his equivalent from last year

Hello PBI community,

I am having trouble trying to simply show a column from last year when I select a date on my slicer
Here is an example of my data:

NameDate
Coca2019
Fanta2019
Ice Tea2019
Pepsi2020
Fanta2020
Ice Tea2020
Sprite2020

 

  • How can I create a dax measure that will show below table, if I select 2020 in my slicer:
NameDate
Coca2019
Fanta2019
Ice Tea2019

 

  • And is it possible to show what are the differences between 2020 and the previous year ? For example, the differences we can see here from 2019 to 2020, is that Coca is missing, and Pepsi & Sprite have been added.

    Thank you for your help !

2 REPLIES 2
amitchandak
Super User
Super User

@Bastienlin_ , With separate date/year table, use these type of measures with name

 

This Year = CALCULATE(Count('Table'[Name]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE(Count('Table'[Name]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))

Hi @amitchandak thank you for your answer.

Nevertheless, your measure seems to only count the rows from a year and another. What I would like is to show the list of the column Names from a year and also the previous one.
If i select 2020 in my slicer, i want to show:

NameDate
Coca2019
Fanta2019
Ice Tea2019

 

And do you have an idea for my second point: "is it possible to show what are the differences between 2020 and the previous year ? For example, the differences we can see here from 2020 and the previous year, are that Coca is missing, and Pepsi & Sprite have been added."

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.