cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

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
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors