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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.