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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

How to retrieve 2 Selected values and use both values in a measure Calculation ?????

Hello everyone,

So I have a problem with my dash and I don't know if there's actually a solution; I want to retrieve the selected values of a slicer and use those values inside a calculated column, so far everything I tried doesn't seem to work. To put you in context, I'm trying to see all the tasks that passed from a "Status 1" to "Status 2" in a table, i've created a column called Transition status : 

TransitionStatus =
VAR CurrentStatus = 'Task History'[projects.note_status_history.status_title]
VAR NextStatus =
    CALCULATE(
        FIRSTNONBLANK('Task History'[projects.note_status_history.status_title], 1),
        FILTER('Task History', 'Task History'[projects.note_status_history.note_id] = EARLIER('Task History'[projects.note_status_history.note_id]) && 'Task History'[New date] > EARLIER('Task History'[New date]))
    )
RETURN
    IF(
        CurrentStatus ="Status 1" && NextStatus ="Status 2",
        "Status 1 to 2",
        "Other"
    )

When I explicitly write "Status 1" and "Status 2" in the calculation (like the example above), everything works. but when i replace '' CurrentStatus ="Status 1" && NextStatus ="Status 2" '' with for example "CurrentStatus = SM && NextStatus =FM" it doesn't work. the value SM and FM are measures within the table. 

I want to be able to change the values of CurrentStatus & NextStatus from outside the formula (from a slicer SELECTEDVALUES for example).

INFO : currentStatus and NextStatus are values from the same Column or Slicer. 

I appreciate any kind of help! Thank you.
3 REPLIES 3
Anonymous
Not applicable

Anonymous
Not applicable

I'm actually looking to select all the Tasks that their Status passed from a "Status 1" to "Status 2". If I replace "&&" with "OR", I will have both tasks that are "Status 1" and never had a "Status 2" and also tasks with "Status 2" but never were "Status 1".

The tutorial you gave me doesn't respond to what I need, I'll explain better : 
I want to be able to retrieve the values of CurrentStatus and NextStatus dynamically; meaning I want to select the CurrentStatus and NextStatus from a slicer (or maybe from something else if that was possibe). 
If on a slicer I select "Status 4" and "Status 5" for example, i want the values selected to be placed inside the formula I posted in the last block. so we'll have :

    IF(
        CurrentStatus ="Status 4" && NextStatus ="Status 5",
        "Status 1 to 2",
        "Other"
    )


I hope the problem is very clear now.

Thank you in advance.

amitchandak
Super User
Super User

@Anonymous , it should be or not end

 

IF(
CurrentStatus ="Status 1" ||  NextStatus ="Status 2",
"Status 1 to 2",
"Other"
)

 

and can be there at a level

example

And for Selected Values, All selected values are present: https://youtu.be/X5T4rIZovHk

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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