Forum Discussion
Filtered SWITCH with blank values
- 6 years ago
Hi Anonymous
Enter value(like c,d) which you'd like to use as priority into a table and keep the value on the order as you need.
then in Transform data, add a custom column from the "value" list and extract values.
close&&apply, create columns with dax
Column1 = IF([User]<>BLANK(),FIND([User],[Custom],1,0)) Column = VAR m = CALCULATE ( MIN ( [Column1] ), FILTER ( 'Table 4', 'Table 4'[Site] = EARLIER ( 'Table 4'[Site] ) && 'Table 4'[Column1] > 0 ) ) RETURN IF ( m <> BLANK (), CALCULATE ( MIN ( 'Table 4'[User] ), FILTER ( 'Table 4', 'Table 4'[Site] = EARLIER ( 'Table 4'[Site] ) && [Column1] = m && [Column1] > 0 ) ), "Unconfirmed" )Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
HI Anonymous
Create columns
rank =
IF (
[User] <> BLANK (),
RANKX (
FILTER (
'Table',
'Table'[Site] = EARLIER ( 'Table'[Site] )
&& 'Table'[User] <> BLANK ()
),
[User],
,
ASC,
DENSE
)
)
you wanted =
VAR r =
CALCULATE (
MIN ( 'Table'[User] ),
FILTER (
'Table',
'Table'[Site] = EARLIER ( 'Table'[Site] )
&& 'Table'[rank] = 1
)
)
RETURN
IF ( r = BLANK (), "Unconfirmed", r )
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous6 years agoNot applicable
Thank you for your reply. I feel this is on the right track. However, the [User] field is not ranked alphabetically. I need something where I can create my own dictionary/assign ranks in a hard coded manner.
Site User Wanted 1 a c 1 b c 1 c c 1 d c 2 c c 2 b c 2 c 3 d d 3 b d 4 a d 4 d d 5 a Unconfirmed 5 e Unconfirmed 6 Unconfirmed 7 c c 8 e Unconfirmed I just re-drew the table to give arbitrary priority to the letters 'c' and 'd' over all other letters. Then the other letters would lose all value and count as 'Unconfirmed'.
I created a new column and came up with random alphabetical names in order to make your original formula work. Is there a formula where I can do this in less columns?
I originally thought that the SWITCH formula would accept the ordering of my query as a ranking system. I am trying to find a query that will let me rank inside the formula. The [User] field has over 400 unique values and is text based. I am trying to select 4 of these unique values in the 'User' field and rank them. Every other of the 400 remaining 'User' values will be considered 'Unconfirmed'.
- v-juanli-msft6 years agoCommunity Support
Hi Anonymous
Enter value(like c,d) which you'd like to use as priority into a table and keep the value on the order as you need.
then in Transform data, add a custom column from the "value" list and extract values.
close&&apply, create columns with dax
Column1 = IF([User]<>BLANK(),FIND([User],[Custom],1,0)) Column = VAR m = CALCULATE ( MIN ( [Column1] ), FILTER ( 'Table 4', 'Table 4'[Site] = EARLIER ( 'Table 4'[Site] ) && 'Table 4'[Column1] > 0 ) ) RETURN IF ( m <> BLANK (), CALCULATE ( MIN ( 'Table 4'[User] ), FILTER ( 'Table 4', 'Table 4'[Site] = EARLIER ( 'Table 4'[Site] ) && [Column1] = m && [Column1] > 0 ) ), "Unconfirmed" )Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.