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
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
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.