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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Danielecc
Helper II
Helper II

How to Check if group have correlative numbers

Hi Everyone,

 

I am looking for something to check if I group by "Seller" see if they have the correlative numbers or not (could be repeated or not be in order), creating a DAX calculated column called "CHECK".

 

Something like this:

Check_Num.png

 

The data is:

SellerWithCODENumbers

D.CelisEEUU011
D.CelisEEUU021
D.CelisEEUU032
D.CelisEEUU052
J.PerezEEUU011
J.PerezEEUU021
J.PerezEEUU073
J.PerezEEUU032
J.PerezEEUU054
J.PerezEEUU134
J.PerezEEUU025
S.GomezEEUU061
S.GomezEEUU121
S.GomezEEUU093
S.GomezEEUU032
S.GomezEEUU102
S.GomezEEUU135
S.GomezEEUU156
J.SmithEEUU011
J.SmithEEUU021
J.SmithEEUU093
J.SmithEEUU034
J.SmithEEUU055
J.SmithEEUU156
J.SmithEEUU076
P.CourtEEUU011
P.CourtEEUU022
P.CourtEEUU072
P.CourtEEUU034
P.CourtEEUU044
P.CourtEEUU145
P.CourtEEUU115
S.KentEEUU061
S.KentEEUU121
S.KentEEUU093
S.KentEEUU032
S.KentEEUU082
S.KentEEUU144
S.KentEEUU114
P.McayEEUU011
P.McayEEUU021
P.McayEEUU072
P.McayEEUU045
P.McayEEUU057

 

 

Thanks a lot and best regards...

2 ACCEPTED SOLUTIONS
CNENFRNL
Community Champion
Community Champion

Screenshot 2021-11-28 222714.png

 

For fun, a solution with Excel worksheet formula,

Screenshot 2021-11-28 224156.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

Hi @CNENFRNL , thanks for your post.

Your code works in my example but for some reason in the real file I have differences with my result.

 

I used this code and work:

Match =
IF(INFO[Numbers]<>BLANK(),
VAR _MAX = CALCULATE(MAX(INFO[Numbers]),FILTER(INFO,INFO[Numbers]<>BLANK()),ALLEXCEPT(INFO,INFO[Seller]))
VAR _NUM = CALCULATE(DISTINCTCOUNT(INFO[Numbers]), INFO[Numbers]<>BLANK(),ALLEXCEPT(INFO,INFO[Seller]))
VAR _RESULT = IF( (_MAX - _NUM) = 0,"Match",BLANK())
RETURN
_RESULT
)

 

Your code is ok in the example, then I Accept as Solution. Thank's for your help and best regards.

View solution in original post

4 REPLIES 4
CNENFRNL
Community Champion
Community Champion

Screenshot 2021-11-28 222714.png

 

For fun, a solution with Excel worksheet formula,

Screenshot 2021-11-28 224156.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Hi @CNENFRNL , thanks for your post.

Your code works in my example but for some reason in the real file I have differences with my result.

 

I used this code and work:

Match =
IF(INFO[Numbers]<>BLANK(),
VAR _MAX = CALCULATE(MAX(INFO[Numbers]),FILTER(INFO,INFO[Numbers]<>BLANK()),ALLEXCEPT(INFO,INFO[Seller]))
VAR _NUM = CALCULATE(DISTINCTCOUNT(INFO[Numbers]), INFO[Numbers]<>BLANK(),ALLEXCEPT(INFO,INFO[Seller]))
VAR _RESULT = IF( (_MAX - _NUM) = 0,"Match",BLANK())
RETURN
_RESULT
)

 

Your code is ok in the example, then I Accept as Solution. Thank's for your help and best regards.

AlexisOlson
Super User
Super User

Can you clarify what you mean by "correlative numbers"? I don't understand what condition causes OK or FAIL.

Hi @AlexisOlson , thanks for see the post.

 

For example, if you see the Group "J.Perez" have numbers:

1, 1, 3, 2, 4, 4, 5

The min number es 1

The max number is 5

Then the range must be 1, 2, 3, 4, 5

And if you compare the range:  1, 1, 3, 2, 4, 4, 5  <-- this range have all the numbers 1 to 5.

 

Now a "FAIL" example with the Group "S.Gomez" with numbers:

1, 1, 3, 2, 2, 5, 6

The Min number is 1

The Max number is 6

Then the rangue must be 1, 2, 3, 4, 5, 6

And if you compare the range: 1, 1, 3, 2, 2, 5, 6  <-- in this range the number 4 not exist, for that reason "FAIL" if any number not exist between the min or max, then FAIL.

 

Sorry for my bad english and I hope this explanation help to understand my post.

 

Thank's again and best regards...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.