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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
yforti
Helper II
Helper II

Help with dax formula

Hi guys!

I need to create a measure that counts column "Repetidos" only once per order number (NroPedido2).

Currently the measurement is repeated for all lines.

As we can see in the image we only have 2 order numbers (001510529792R7 and 001510529792R6), I need the measurement to count only 1 time for each order.


My measurement x counts the number of orders that are repeated on a different day.

Repetidos =
CALCULATE(
    DISTINCTCOUNT(iFrame[NroPedido2]),
    FILTER(
        iFrame,
        iFrame[NroPedido2] = EARLIER(iFrame[NroPedido2])
        && iFrame[DateSession - Copiar] <> EARLIER(iFrame[DateSession - Copiar])))

In other words, if an order number is repeated on any other different day, it counts as a repeat.



yforti_0-1702586108515.png


Thanks for help!

1 ACCEPTED SOLUTION
VahidDM
Super User
Super User

HI @yforti 

 

Try this:

Repetidos = 
VAR UniqueOrdersPerDay = 
    SUMMARIZE(
        iFrame,
        iFrame[NroPedido2],
        iFrame[DateSession - Copiar],
        "OrderCount", COUNTROWS(iFrame)
    )
VAR RepeatedOrders = 
    SUMMARIZE(
        UniqueOrdersPerDay,
        [NroPedido2],
        "DaysCount", COUNTROWS(UniqueOrdersPerDay)
    )
RETURN
    COUNTROWS(
        FILTER(
            RepeatedOrders,
            [DaysCount] > 1
        )
    )

 

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

Appreciate your Kudos!! 

Badges.jpg

LinkedIn | Twitter | Blog | YouTube 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @yforti ,

Have you solved your problem? If solved please mark the reply in this post which you think is helpful as a solution to help more others facing the same problem to find a solution quickly, thank you very much!

Best Regards,

Xianda Tang

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

VahidDM
Super User
Super User

HI @yforti 

 

Try this:

Repetidos = 
VAR UniqueOrdersPerDay = 
    SUMMARIZE(
        iFrame,
        iFrame[NroPedido2],
        iFrame[DateSession - Copiar],
        "OrderCount", COUNTROWS(iFrame)
    )
VAR RepeatedOrders = 
    SUMMARIZE(
        UniqueOrdersPerDay,
        [NroPedido2],
        "DaysCount", COUNTROWS(UniqueOrdersPerDay)
    )
RETURN
    COUNTROWS(
        FILTER(
            RepeatedOrders,
            [DaysCount] > 1
        )
    )

 

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

Appreciate your Kudos!! 

Badges.jpg

LinkedIn | Twitter | Blog | YouTube 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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