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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
snaraya
Helper II
Helper II

Values need to be changed as per multiple slicer selection

Hi Everyone,

 

I need the line in chart to change as per multiple slicer selections.I am using line and stacked column chart. X axis will have count of Classification . now i have removed in the graph below.

I am halfway through, its getting changed as per two slicer (Year and BU) but not the third one(Classification) and only shows up if that year is selected.


my Target line for 2021 should be as below if , Year 2021 and BU selection but no Classification is selected. (which i am able to achieve)

"AA"= 0.85,
"CC" =0.63,
"CA"= 0.86,
"GF"= 0.35,
if no BU selected 0.66

 

Now if any classification is selected along with year which is (lost time accident or Restricted work) the values should change as below 


"AA"=0.31,


"CC"=0.31,
"CA"= 0.38,
"GF" = 0.15,
No BU selected 0.27

 

My DAX formula: 

 

Test 2021 = 
IF(SELECTEDVALUE('Calendar'[Year])=2021,
 SWITCH (
    SELECTEDVALUE ( vw_dart_fte[New BU] ),
    "AA", 0.85,
    "CC", 0.63,
    "CA", 0.86,
    "GF",0.35,
    0.66
),(IF(SELECTEDVALUE('Calendar'[Year])=2021 && (SELECTEDVALUE(vw_dart_lta[classification])="Lost Time Accident") || (SELECTEDVALUE(vw_dart_lta[classification])= "Restricted work"),
SWITCH(SELECTEDVALUE(vw_dart_fte[New BU]),
   
    "AA", 0.31,
    "CC", 0.31,
    "CA", 0.38,
    "GF",0.15,
    0.27
))))

 

 

 

This the relationship between three tables. there is no Common column between dart_lta and dart_fte so i created a column which combination of year, month number and BU for there relationship. and with month number and year created a date column in both tables so that they can be conncetd to Calendar table. 

Relationship.PNG

 

so here is screenshot of my graph..where you can see, if the classification is selected it still shows value of 0.66 but it should show 0.27. so all the values it showing up are of 1st condition where no classisfication is selected 

 

with classification.PNG

 

here it should show 0.38 

 

BU selected.PNG


Can someone help me in this?

Thankyou in advance

 

 

 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @snaraya 
Please try

Test 2021 =
VAR Year2021 =
    SELECTEDVALUE ( 'Calendar'[Year] ) = 2021
VAR SelectedBU =
    SELECTEDVALUE ( vw_dart_fte[New BU] )
RETURN
    IF (
        Year2021,
        IF (
            ISFILTERED ( vw_dart_lta[classification] ),
            SWITCH (
                SelectedBU,
                "AA", 0.31,
                "CC", 0.31,
                "CA", 0.38,
                "GF", 0.15,
                0.27
            ),
            SWITCH (
                SelectedBU,
                "AA", 0.85,
                "CC", 0.63,
                "CA", 0.86,
                "GF", 0.35,
                0.66
            )
        )
    )

View solution in original post

2 REPLIES 2
tamerj1
Super User
Super User

Hi @snaraya 
Please try

Test 2021 =
VAR Year2021 =
    SELECTEDVALUE ( 'Calendar'[Year] ) = 2021
VAR SelectedBU =
    SELECTEDVALUE ( vw_dart_fte[New BU] )
RETURN
    IF (
        Year2021,
        IF (
            ISFILTERED ( vw_dart_lta[classification] ),
            SWITCH (
                SelectedBU,
                "AA", 0.31,
                "CC", 0.31,
                "CA", 0.38,
                "GF", 0.15,
                0.27
            ),
            SWITCH (
                SelectedBU,
                "AA", 0.85,
                "CC", 0.63,
                "CA", 0.86,
                "GF", 0.35,
                0.66
            )
        )
    )

@tamerj1 Thankyou so much.Worked perfectly fine

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.