0

Just have a very simple question on how to index a value in PowerBI, suppose I have the following data set loaded.

enter image description here

Now, suppose I want the value 55 from the alert status column. Index wise (starting from 0), it would be (4, 2). What is the easiest way to select value 55? For example, in Python, I can go Table[4, 2].

Rui Nian
  • 2,544
  • 18
  • 32

1 Answers1

1

Here is a DAX expression that returns the scalar value 55.

CALCULATE (
    SELECTEDVALUE ( 'Table'[Alert Status] ),
    'Table'[Status] = 4
)

You can quickly examine this by clicking New Table in the Modeling tab, and copy & pasting the following formula.

Test = ADDCOLUMNS (
    ROW ( "Status to Lookup", 4 ),
    "Result",
    VAR StatusToLookup = [Status to Lookup]
    RETURN CALCULATE (
        SELECTEDVALUE ( 'Table'[Alert Status] ),
        'Table'[Status] = StatusToLookup
    )
)

Output

Kosuke Sakai
  • 2,336
  • 2
  • 5
  • 12