Forum Discussion

samc_26's avatar
samc_26
Helper IV
2 years ago

Multiple IF statements to check value from another table

**Edited**

 

Hi, so I'm trying to write an IF statement into a new column but not getting anywhere...I have two tables which are related through the measure name and I'm trying to create a new column that does something like the below. Please excuse my poor attempt at explaining/using the correct code! Hopefully this makes some sense! Any help would be massively appreciated! Thank you

 

If the value in the Values table is >= Green in RAG Status table = "Green" else >= Amber && <Green = "Amber" else "Red"

 

VALUES TABLE

Value NameWeek NoValues
Value AWeek 150%
Value AWeek 275%
Value BWeek 125%
Value BWeek 2100%

 

RAG Status Table ( I have an unpivoted version of this table too)

Value name RedAmberGreen
Value A69%85%100%
Value B85%90%100%

2 Replies

  • edhans's avatar
    edhans
    Community Champion

    Tables are not related through measures. You can create virtual relationships in measures, and you can deactivate or update types of relationships in measures, but that is only for that measure. Relationships are done on the modeling tab and those are the only relationships that physically exist.

    Measure tables should hold no data. They are just a place to store measures, so a measure table should not be green or red or anything else.

    Also, you said "value in the measures table is >= Green" - even if you replaced "measure table" with "measure" or "column" or anything else, nothing can be > green unless you are looking at hex codes for colors, which I doubt. It is either green, or it is not.

     

    How to get good help fast. Help us help you.

    How To Ask A Technical Question If you Really Want An Answer

    How to Get Your Question Answered Quickly - Give us a good and concise explanation
    How to provide sample data in the Power BI Forum - Provide data in a table format per the link, or share an Excel/CSV file via OneDrive, Dropbox, etc.. Provide expected output using a screenshot of Excel or other image. Do not provide a screenshot of the source data. I cannot paste an image into Power BI tables.

    • samc_26's avatar
      samc_26
      Helper IV

      Sorry I think I've made this confusing, the measure I'm relating to in this example is not a power bi measure, it's a measurable value such as 'temperature', I just used the word measure as I have a long list of different values that I need to check against a target or RAG targets. There are no actual power query technical measures involved in this example