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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
marcvd
Frequent Visitor

Group previous years based on selected year

Hi all

 

I would like to summarise / group by years in a table based on a selected year.

 

Have data for 2020, 2021, 2022 and 2023.

Three columns voucher, date and amount.

 

When I select 2023 I would like to show the 2023 vouchers in detail (with voucher and date) and at the top the summary of the previous year (one row, only the amount).

Is this possible?

 

Thanks in advance!

M

1 REPLY 1
Anonymous
Not applicable

Hi, @marcvd 

Based your infomation, I create a table:

vyohuamsft_1-1709186589580.png

 

You can try using DAX with visuals. If we don't have a Year column, we can create a Year column first, and then put the new column into the slicer.

 

vyohuamsft_0-1709186558307.png

Year = YEAR('Table'[Date])

 

Create a Measure called Previous Year Summary and put it in the card visual to show the total revenue for the previous year for the selected year.

 

vyohuamsft_3-1709186680595.png

DAX:

Previous Year Summary = 
CALCULATE(
    SUM('Table'[Amount]), 
    FILTER(
        ALL('Table'), 
        'Table'[Year] < MAX('Table'[Year])&& YEAR('Table'[date]) = YEAR(MIN('Table'[date])) - 1
    )
)

 

Then put all the information of the voucher into another table. Here's my preview:

vyohuamsft_4-1709186815250.png

 

How to Get Your Question Answered Quickly 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data)

Best Regards

Yongkang Hua

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.