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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
TKhanca
Regular Visitor

How to calculate with different slicer value

Hello,

 

I have two measures on the card visual with filter table1[Year]. First measure is fine and filtering counts based on the selection from the slicer. How can I calculate counts for a diffrent year when table1[Year] is selected. (e,g table1[Year]-3).

 Relationship Year[table1] = Year[table2]

Thank you.

1 ACCEPTED SOLUTION

@Bibiano_Geraldo , thank you very much for your help.

REMOVEFILTERS(Term[Term_Code]) worked to solve this scenario.

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi @TKhanca ,

Could you please provide sample files or sample files here? We could offer you more help if we have information in detail. And what you expect the output to be. There is sensitive data that can be removed in advance. How to provide sample data in the Power BI Forum - Microsoft Fabric Community

Thanks for your understanding. Your time and cooperation are much valued by us. We are looking forward to hearing from you to assist further.

Best regards,

Lucy Chen

Bibiano_Geraldo
Super User
Super User

Hi @TKhanca ,

You can create a measure like this:

CountForYearMinus3 = 
VAR SelectedYear = MAX('table1'[Year]) -- Get the selected year
VAR TargetYear = SelectedYear - 3 -- Calculate the target year
RETURN
    CALCULATE(
        COUNT('table2'[SomeColumn]), -- Replace 'SomeColumn' with the column you're counting
        FILTER(
            ALL('table1'), -- Remove current slicer filter from table1
            'table1'[Year] = TargetYear
        )
    )

If the slicer filters table1[Year] to 2024:

  • SelectedYear will be 2024.
  • TargetYear will be 2021.
  • The measure will count rows in table2 where the year is 2021.

Thank you very much Bibiano for your help. It worked for Card but I have another Table visual where I need to use this measure with other columns but it always display the same value.

Can you show me a picture of your table visual?

 

 

 

@Bibiano_Geraldo , thank you very much for your help.

REMOVEFILTERS(Term[Term_Code]) worked to solve this scenario.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.

Top Solution Authors