Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Quentin_
Helper I
Helper I

Deduplicate ID based on not superior rank

Hello,

 

I try to find the right method to calculate the number of deduplicated ID with a restriction values in the same column but I block when I need to used multiple filters.

 

Example : Table_ID_rank  -> 

Description about the values in the table "ID + completion" (this table indicate the completion by ID).

During the ID navigation, this ID can be send multiple values (0%, 50%, 75% and 100% if it's complete). If an ID come back, it will send the last completion (exemple not 0%, not 50%, 75%, 100% if it finish).

 

Values in the table :

 

IDCompletion (int)
abcdef50
abcdef75
abcdef100
poujkd100
qwerty100
plodse50
plodse75
siropderable50
docsoqqp50
docsoqqp75

 

 

I would like count the number of ID by rank with a restriction on the top row.

 

Example

Unique ID for the rank "50" : result -> 1 (ID : siropderable) Unique ID on my table at the range "50" 

Unique ID for the rank "75" : result -> 2 (ID : plodse and docsoqqp)

Unique ID for the rank "100" : result -> 3 (ID : abcdef, poujkd, qwerty

 

 

For the rank 100 i used the following dax query :

ID completion 100 = CALCULATE(DISTINCTCOUNT('Table_ID_rank[ID]); 'Table_ID_rank[ID] = 100)
 
Results : 3 - OK
 
IDCompletion (int)
abcdef100
poujkd100
qwerty100
 
 
Problem is for the inferior rank with a restriction.
I tried for the rank 75 the following query :
ID completion 75= CALCULATE(DISTINCTCOUNT('Table_ID_rank[ID]); ('Table_ID_rank[ID] = 75 & 'Table_ID_rank[ID] <> 100))
 
Results : 3 - NOK
 
IDCompletion (int)
abcdef75
plodse75
docsoqqp75

 

I would like obtain 2 because id "abcdef" will be not add to this result (he has a value 100 in the table).

 

Have you got an idea to fix my problem ?

 

Thank you,

 

 
1 ACCEPTED SOLUTION
harshnathani
Community Champion
Community Champion

Hi @Quentin_ ,

 

 

You can approach the solution like this.

 

Create 2 Calculated Column.

 

2.JPG

 

 

 

Ranking Column = RANKX(FILTER('Table','Table'[D] = EARLIER('Table'[D])),'Table'[Completion (int)])

 

Previous Completion = 
CALCULATE(MAX('Table'[Completion (int)]),FILTER('Table','Table'[D] = EARLIER('Table'[D])  && 'Table'[Ranking Column] = EARLIER('Table'[Ranking Column])-1))

 

 

Then create 3 measures.

 

Count100 = CALCULATE(DISTINCTCOUNT('Table'[D]), FILTER('Table','Table'[Completion (int)] = 100 && 'Table'[Previous Completion] = BLANK()))

 

 

Count75 = CALCULATE(DISTINCTCOUNT('Table'[D]), FILTER('Table','Table'[Completion (int)] = 75 && 'Table'[Previous Completion] = BLANK())) 

 

Count50 = CALCULATE(DISTINCTCOUNT('Table'[D]), FILTER('Table','Table'[Completion (int)] = 50 && 'Table'[Previous Completion] = BLANK()))

 

1.jpg

 

 

Regards,
Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Quentin_ ,

 

Create a measure as below:

 

_Completion (int) = 
var maxvalue=MAXX(FILTER(ALL('Table'),'Table'[ID]=MAX('Table'[ID])),'Table'[Completion (int)])
Return
IF(maxvalue in FILTERS('Table'[Completion (int)]),maxvalue,BLANK())

 

Finally you will see:

Annotation 2020-06-15 131538.pngAnnotation 2020-06-15 131505.pngAnnotation 2020-06-15 131526.png

For the related .pbix file, pls click here.

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!
harshnathani
Community Champion
Community Champion

Hi @Quentin_ ,

 

 

You can approach the solution like this.

 

Create 2 Calculated Column.

 

2.JPG

 

 

 

Ranking Column = RANKX(FILTER('Table','Table'[D] = EARLIER('Table'[D])),'Table'[Completion (int)])

 

Previous Completion = 
CALCULATE(MAX('Table'[Completion (int)]),FILTER('Table','Table'[D] = EARLIER('Table'[D])  && 'Table'[Ranking Column] = EARLIER('Table'[Ranking Column])-1))

 

 

Then create 3 measures.

 

Count100 = CALCULATE(DISTINCTCOUNT('Table'[D]), FILTER('Table','Table'[Completion (int)] = 100 && 'Table'[Previous Completion] = BLANK()))

 

 

Count75 = CALCULATE(DISTINCTCOUNT('Table'[D]), FILTER('Table','Table'[Completion (int)] = 75 && 'Table'[Previous Completion] = BLANK())) 

 

Count50 = CALCULATE(DISTINCTCOUNT('Table'[D]), FILTER('Table','Table'[Completion (int)] = 50 && 'Table'[Previous Completion] = BLANK()))

 

1.jpg

 

 

Regards,
Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

 

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.