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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Syntax Error Occurred during Parsing: Invalid Token Line 7 Offset 56

Hi,
I am getting this error when i using the  formula  and the find the duplicate values in a same column to return output as 0, 1
Any Help please? 

Duplicate =
--VAR dCount =
    COUNTROWS (
        FILTER (
            'DB 15092022_1',
            'DB 15092022_1'[STO Number] = EARLIER ( 'DB 15092022_1'[STO Number] )
                && 'DB 15092022_1'[Index] <= EARLIER ( 'DB 15092022_1[Index] )
        )
    ))))

LikhithaVG123_0-1664180133968.png

 

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @Anonymous 


You can try the following formula.

Duplicate =
VAR _dCount =
    COUNTROWS (
        FILTER (
            'DB 15092022_1',
            'DB 15092022_1'[STO Number] = EARLIER ( 'DB 15092022_1'[STO Number] )
                && 'DB 15092022_1'[Index] <= EARLIER ( 'DB 15092022_1'[Index] )
        )
    )
RETURN
    IF ( _dCount > 1, 1, 0 )

 

If you have a large amount of data, you can try to calculate with measure.
Measure:

Duplicate =
VAR _dCount =
    COUNTROWS (
        FILTER (
            ALL ( 'DB 15092022_1' ),
            'DB 15092022_1'[STO Number] = SELECTEDVALUE ( 'DB 15092022_1'[STO Number] )
                && 'DB 15092022_1'[Index] <= SELECTEDVALUE ( 'DB 15092022_1'[Index] )
        )
    )
RETURN
    IF ( _dCount > 1, 1, 0 )

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

6 REPLIES 6
v-zhangti
Community Support
Community Support

Hi, @Anonymous 


You can try the following formula.

Duplicate =
VAR _dCount =
    COUNTROWS (
        FILTER (
            'DB 15092022_1',
            'DB 15092022_1'[STO Number] = EARLIER ( 'DB 15092022_1'[STO Number] )
                && 'DB 15092022_1'[Index] <= EARLIER ( 'DB 15092022_1'[Index] )
        )
    )
RETURN
    IF ( _dCount > 1, 1, 0 )

 

If you have a large amount of data, you can try to calculate with measure.
Measure:

Duplicate =
VAR _dCount =
    COUNTROWS (
        FILTER (
            ALL ( 'DB 15092022_1' ),
            'DB 15092022_1'[STO Number] = SELECTEDVALUE ( 'DB 15092022_1'[STO Number] )
                && 'DB 15092022_1'[Index] <= SELECTEDVALUE ( 'DB 15092022_1'[Index] )
        )
    )
RETURN
    IF ( _dCount > 1, 1, 0 )

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Anonymous
Not applicable

Hi,

thank you for the solution
I have tried by using Measure it works, but now from the Output 1, 0's i need to fo sum of the 0's and 1's
how can i do with the measure?
because to calcualte the SUM OF 0's and 1's i need to create a column right 

with the measure output i am unable ot create Sum of 0's and 1's?

Any help?

Duplicate =
VAR _dCount =
COUNTROWS (
FILTER (
ALL ( 'DB 15092022_1' ),
'DB 15092022_1'[STO Number] = SELECTEDVALUE ( 'DB 15092022_1'[STO Number] )
&& 'DB 15092022_1'[Index] <= SELECTEDVALUE ( 'DB 15092022_1'[Index] )
)
)
RETURN
IF ( _dCount > 1, 1, 0 )

Anonymous
Not applicable

Thank you so much for the solution.

By using Measure i got the output
but one more issue is that from the output i need to take the sum of 0,1 

i am not able to perform the sum on the measure.
to calculate SUM i need to use column right. but with measure i am not able to calculate SUM of 0's & 1's


Any suggesstions please?

Thanks

Anonymous
Not applicable

Hi,

Any sugesstion please?

Thanks

amitchandak
Super User
Super User

@Anonymous , Problem with Single quote in table name, Try like

 

Duplicate =
--VAR dCount =
COUNTROWS (
FILTER (
'DB 15092022_1',
'DB 15092022_1'[STO Number] = EARLIER ( 'DB 15092022_1'[STO Number] )
&& 'DB 15092022_1'[Index] <= EARLIER ( 'DB 15092022_1'[Index] )
)
)

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi Amit,

I have tried the formula as you suggested but it is taking more time to excecute please see the screenshot below
I am using excel as a source and it has 31k records of Data. Any suggestion please?

LikhithaVG123_0-1664183549856.png

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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