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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
thomasreick
Resolver I
Resolver I

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
Resolver I
Resolver I

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
 
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.


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
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

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
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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