cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
thomasreick
New Member

Using a Card-Visual as a conditoin for LOOKUP from a table

Hi all,

From a table I am selecting the MAX(Value) to be shown in a Card-Visual.

I would like to use this value to check in a IF-THEN-ELSE-Kind of functionality to return a plain text like 'High', 'Medium', 'Low'.

This plain text should be used to perform LOOKUP on a different table to get additonal data.

Is there a way to get this kind of interdependency running?

Ia m actually not yet familiar with writing / using DAX-functions

 

Appreciating your input.

 

thx in advance

Thomas

1 ACCEPTED SOLUTION
selimovd
Super User
Super User

Hey @thomasreick ,

 

sure, that's possible.

Try the following:

MyMeasure =
VAR vMaxValue = MAX( myTable[Value] )
VAR vCategory =
    SWITCH(
        TRUE(),
        vMaxValue < 10, "Low",
        vMaxValue < 20, "Medium",
        "High"
    )
RETURN
    LOOKUPVALUE(
        myResultTable[ResultColumn],
        myResultTable[SearchColumn], vCategory
    )

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

View solution in original post

5 REPLIES 5
thomasreick
New Member

Hi all,

thank you very much for your contributions.

 

I checked all of your proposals. All of them worked out fine so it is hard to decide "the one" accepted.

I favoured Selimovd's solution, because this one matches most my way of thinking.

 

The fun fact: I possibly made my issue not clear enough. I asked the follwing:

"I would like to use this value to check in a IF-THEN-ELSE-Kind of functionality to return a plain text like 'High', 'Medium', 'Low'."

What I meant was: "I would like to refer to this visual's value to check ..... ".

Reason why: I do VBA-Programming (MS-Access) and sometimes there is the need to refer to a value within a control. I thought there is a similar approach in PBI.

 

But nevertheless, all your proposals have made my day.

 

Thank you very much.

 

Thomas

selimovd
Super User
Super User

Hey @thomasreick ,

 

sure, that's possible.

Try the following:

MyMeasure =
VAR vMaxValue = MAX( myTable[Value] )
VAR vCategory =
    SWITCH(
        TRUE(),
        vMaxValue < 10, "Low",
        vMaxValue < 20, "Medium",
        "High"
    )
RETURN
    LOOKUPVALUE(
        myResultTable[ResultColumn],
        myResultTable[SearchColumn], vCategory
    )

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

View solution in original post

Greg_Deckler
Super User
Super User

@thomasreick Well, you could write a DAX measure similar to:

Measure =
  VAR __Max = MAX('Table'[Column]) //this would be filtered to whatever your card visual is
RETURN
  SWITCH(
    <condition 1>,"Result 1",
    <condition 2>,"Result 2",
    <condition 3>,"Result 3",
    <default condition>
  ) //you can compare with the __Max variable in your conditions.

@ me in replies or I'll lose your thread!!!
Check out my External Tool for Power BI Desktop!
Microsoft Hates Greg's Quick Measures
Check out my latest book!

amitchandak
Super User
Super User

@thomasreick , I think you can do that.

Assume you have an independent bucket table with Min max and value

Example measure 

maxx(filter('Bucket', Bucket[Min] <= [Measure] && Bucket[Max] >= [Measure]), 'Bucket'[Value]])

 

also refer

Dynamic Segmentation, Bucketing or Binning: https://youtu.be/CuczXPj0N-k



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Fowmy
Super User
Super User

@thomasreick 

Yes, it's possible.  you can create a measure to evaluate into text values and use it to look up on a table to fetch a matching record and the required value.

Please share sample data and the expected result.

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power BI October Update 2021.jpg

Power BI Release

Click here to read more about the October 2021 Release!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Teds Dev Camp Oct. 2021 768x460.jpg

Power BI Dev Camp - October 28th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!