Sc0719
Sc0719

Reputation: 75

Replicate Excel Formula in Power BI

I am trying to put together an IF statement on Power BI similar to what I have managed to do in Excel. Looking for Journey Order to add 1 for ever duplicate counted in the Journey Key Column.

If( Journey Key = Journey Key, Journey Order + 1, 1 )

Example = IF( A3 = A2, B2+1, 1)

Table

Is there any DAX formula within Power BI that would replicate the above?

Upvotes: 0

Views: 154

Answers (1)

Ozan Sen
Ozan Sen

Reputation: 2615

If It is acceptable for you, I can recommend an alternative solution: For this, You need an index column: Let's say you have a table like this:

Index   Journey Key
1        WI1234
2        WI1234
3        WI4321
4        WI4321
5        WI4321

Then you can create a DAX measure using this code:

Journey Order = CALCULATE(
    COUNT(JourneyTable[Journey Key]),
FILTER(
    ALL(JourneyTable[Index]),
        JourneyTable[Index] <= MAX(JourneyTable[Index])
)
)

TETA

Upvotes: 1

Related Questions