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
Anonymous
Not applicable

SELECTEDVALUE AND MARK THIS ON ANOTHER TABLE

SelectedDateFlag.pngHi Guys, I'm using this to select the current date selected:

Selected Date =
VAR SelectedDate = SELECTEDVALUE('Date Init'[Selected])
RETURN
IF(ISBLANK(SelectedDate) ,0 ,SelectedDate)

Then I want to compare this selected value to another table to put a flag:

Flag = IF ('Date'[Selected]=[Selected Date] ,1,0)

Someone know why the second formula is not working, and how I can solve this?

 

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

Hi @Anonymous ,

 

We should create meausre to work on it instead of calcualted column.

Measure = 
VAR sele =
    SELECTEDVALUE ( 'Table'[slicer] )
RETURN
    IF (
        ISFILTERED ( 'Table'[slicer] )
            && MAX ( 'Table (2)'[category] ) = sele,
        1,
        0
    )

Capture.PNG

 

For more details, please check the pbix as attached.

 

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

6 REPLIES 6
v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

We should create meausre to work on it instead of calcualted column.

Measure = 
VAR sele =
    SELECTEDVALUE ( 'Table'[slicer] )
RETURN
    IF (
        ISFILTERED ( 'Table'[slicer] )
            && MAX ( 'Table (2)'[category] ) = sele,
        1,
        0
    )

Capture.PNG

 

For more details, please check the pbix as attached.

 

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Anonymous
Not applicable

Hi 

 

 

TomMartens
Super User
Super User

Hey @Anonymous ,

 

from the syntax of your 2nd formula I deduct that this is a CALCULATED COLUMN, you have to be aware of the different steps that are creating the Power BI data model.

 

Step 1: Power Query (PQ) connects to various data sources, allows to transform data and sets the stage for the Power BI data model. Almost each PQ query results to a table in the Power BI data model. It's not possible to access objects that have been created  by DAX from within PQ

Step 2: Data refresh, during this step data will be loaded to the Power BI data model, this is the obvious part. But also DAX based objects like calculated columns and DAX based tables are created during this step and added to data model. Interaction of users with the data model like selecting slicers will not be recognized, as this step happens before any interaction will be recognized by the data model.

Step 3: The interaction, here the data model is able to reflect interaction with the user.

 

For this you have to transform your second formula to a measure instead.

 

Hopefully this provides some additional insights.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany
Anonymous
Not applicable

Having this clear, my solution for my problem is not viable, I want to do it is to filter dates using two different slicers with start and end date to do an between, my solution was to mark these two dates and then make a mark on the date table between these two implicit values to later filter the dates selected with the brand.

 

This is the filters:

Filtros.png

 

Having that in mind how I can filter between these two different slicers?

 

parry2k
Super User
Super User

@Anonymous seems like you are returing 0 or date based on following formula

 

Selected Date =
VAR SelectedDate = SELECTEDVALUE('Date Init'[Selected])
RETURN
IF(ISBLANK(SelectedDate) ,0 ,SelectedDate)

 

why not do this 

 

Selected Date =
SELECTEDVALUE('Date Init'[Selected])

Flag = IF ('Date'[Selected]=[Selected Date] ,1,0)

or one measure

Flag = IF ('Date'[Selected]=SELECTEDVALUE('Date Init'[Selected]) ,1,0)

 

Would appreciate  Kudos if my solution helped.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Hi thanks a lot for your help, this option does not work.

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.