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
jwulcan
Frequent Visitor

Return value in filter for all rows

Hi,

 

I am new here and need some help to get a measure that genereates the year choose in a filter for all rows.

 

Hence when choosing 2022 in the year filter (marked with yellow) I want the measure (2nd coumn) to write 2022 for all rows in the table below. When choosing 2023 I want it to write 2023 for all rows.

 

Help would be super appreaciated:)

 

Thanks!

 

Capture.PNG

1 ACCEPTED SOLUTION

Hi, @jwulcan 

According to your description, you seem just need to get the data from the slicer "Year".

I think you can try to use the MAX() or selectedvalue() function in it.

MAX('Slicer table'[Year])   or SELECTEDVALUE('Slicer table'[Year])

The 'Slicer table'[Year] is the field you put in the slicer.

Because your slicer selects the corresponding year, then my current filter context is this year, and this year should be returned in all cases.

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

View solution in original post

4 REPLIES 4
FreemanZ
Super User
Super User

hi @jwulcan 

what do you mean by "to write 2022 for all rows in the table below"?

To exlain a little bit further. I want to use this Measure for a Switch measure. So if 2022 is chosen as "year" I want a formula to generate 2022 (as requested in my post above). Then I will use this for a Switch formula with different calculations depending on if the year choosen is 2021, 2022 or 2023.

 

Thanks!

I want to have a formula that returns 2022 for all rows if I have selected 2022 in the year filter. Hence for row with 202101 i want the formula to return 2022, for 202102 return 2022 etc. If I change the year filter to 2023 I want the fomula to write 2023 for all rows. Makes sense?

 

Kind regards,

Johannes

Hi, @jwulcan 

According to your description, you seem just need to get the data from the slicer "Year".

I think you can try to use the MAX() or selectedvalue() function in it.

MAX('Slicer table'[Year])   or SELECTEDVALUE('Slicer table'[Year])

The 'Slicer table'[Year] is the field you put in the slicer.

Because your slicer selects the corresponding year, then my current filter context is this year, and this year should be returned in all cases.

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

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.

Top Solution Authors