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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
nailifarhanah
New Member

Change value based on slicer option

HIi,

 

I have a set of data that as below and I have a another table for the slicer YA data only. I've managed to create the relationship for these 2 from the YA fields:

 

YAStatusTypeProject
2021IncompleteAA1
2021CompleteAA2
2022CompleteAA3
2022CompleteBB1

 

Slicer table
 
YA
2021
2022

 

I want to create a column named [New YA] and it will change its value based on the slicer selected. 

 

For example if i choose from the slicer 2022, those 2021 projects that are incomplete will be tagged as 2022 in the [New YA] column ie the slicer option instead of 2021.

 

The logic is that these prior incomplete projects as at 2022 are now brought forward and included in the YA 2022 list.

Otherwise it will just follow the original YA.

 

Ultimately, the new data table will look like this.

 Slicer (Year)2021  
Data    
YAStatusTypeProjectNew YA if 2021 slicer is chosen
2021IncompleteAA12021
2021CompleteAA22021
2022CompleteAA32022
2022CompleteBB12022

 

 Slicer (Year)2022  
     
YAStatusTypeProjectNew YA if 2022 slicer is chosen
2021IncompleteAA12022
2021CompleteAA22021
2022CompleteAA32022
2022CompleteBB12022

 

Hope I made this simple to understand.

 

How do i do this in power BI?

 

Thank you.

1 ACCEPTED SOLUTION
v-easonf-msft
Community Support
Community Support

Hi, @nailifarhanah 

As a workaround, you can add a measrue like:

New YA = 
VAR _original =
    SELECTEDVALUE ( 'Table'[YA] )
VAR _slicer =
    SELECTEDVALUE ( 'Slicer table'[YA] )
VAR _status =
    SELECTEDVALUE ( 'Table'[Status] )
RETURN
    IF (
        ISFILTERED ( 'Slicer table'[YA] ),
        IF ( _original < _slicer && _status = "Incomplete", _slicer, _original ),
        _original
    )

veasonfmsft_0-1669016944409.png

Best Regards,
Community Support Team _ Eason
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

2 REPLIES 2
v-easonf-msft
Community Support
Community Support

Hi, @nailifarhanah 

As a workaround, you can add a measrue like:

New YA = 
VAR _original =
    SELECTEDVALUE ( 'Table'[YA] )
VAR _slicer =
    SELECTEDVALUE ( 'Slicer table'[YA] )
VAR _status =
    SELECTEDVALUE ( 'Table'[Status] )
RETURN
    IF (
        ISFILTERED ( 'Slicer table'[YA] ),
        IF ( _original < _slicer && _status = "Incomplete", _slicer, _original ),
        _original
    )

veasonfmsft_0-1669016944409.png

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Ashish_Mathur
Super User
Super User

Hi,

Calculated column formulas do not respond to a change in slicers.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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

Top Kudoed Authors