Forum Discussion
Distinct Identifier
- 6 years ago
Infact the formula can be reduced to following. If you need result as Binary, you can chantge the data type to Binary from the Modelling tab>>formatting section. 1 is equivalent to TRUE, 0 is equivalent to FALSE
Column Formula = VAR myrank = RANKX ( CALCULATETABLE ( 'TableName', ALLEXCEPT ( 'TableName', 'TableName'[Store], 'TableName'[City] ) ), [Product], , ASC, DENSE ) RETURN IF ( myrank = 1, 1, 0 )
Try this as a Calculated Column
Column =
VAR IsUnique =
CALCULATE (
COUNTROWS ( 'TableName' ),
ALLEXCEPT ( 'TableName', 'TableName'[Store], 'TableName'[City] )
) = 1
RETURN
IF (
IsUnique,
1,
RANKX (
CALCULATETABLE (
'TableName',
ALLEXCEPT ( 'TableName', 'TableName'[Store], 'TableName'[City] )
),
[Product],
,
DESC,
DENSE
) - 1
)
Zubair_Muhammad This is almost accurate. I have a lot values that end up as 2 or more. One goes up to 23. Is it possible to make it a bianary result like a Yes or No?
- awitt6 years agoHelper III
Zubair_Muhammad So this is the result i'm getting. When really i need the first instance of a store location to read as 1 and all the other instances to read as 0. Sorry for not explaining that at the top, my bad!
- Zubair_Muhammad6 years agoCommunity Champion
Sorry for late reply. Here is the revised formula
Column = VAR IsUnique = CALCULATE ( COUNTROWS ( 'TableName' ), ALLEXCEPT ( 'TableName', 'TableName'[Store], 'TableName'[City] ) ) = 1 RETURN IF ( IsUnique, 1, VAR myrank = RANKX ( CALCULATETABLE ( 'TableName', ALLEXCEPT ( 'TableName', 'TableName'[Store], 'TableName'[City] ) ), [Product], , ASC, DENSE ) RETURN IF ( myrank = 1, 1, 0 ) )- Zubair_Muhammad6 years agoCommunity Champion
Infact the formula can be reduced to following. If you need result as Binary, you can chantge the data type to Binary from the Modelling tab>>formatting section. 1 is equivalent to TRUE, 0 is equivalent to FALSE
Column Formula = VAR myrank = RANKX ( CALCULATETABLE ( 'TableName', ALLEXCEPT ( 'TableName', 'TableName'[Store], 'TableName'[City] ) ), [Product], , ASC, DENSE ) RETURN IF ( myrank = 1, 1, 0 )