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
cdnjj
Frequent Visitor

COUNTX distinct values without CALCULATE

Hello,

 

Any thoughts on how to convert the statement below into a distinct count?    Here's the trick; it needs to be accomplished without using CALCULATE (due to a circular reference limitation).

 

The 2 tables do not have a key as they are not at the same grain (daily vs line level) and trying to avoid creating an intermediate table.

 

Customer Transaction Count = COUNTX(FILTER(SalesLineData , DailySalesSummary[Date]=SalesLineData[Date], SalesLineData[TransactionNumber])

 

Thanks in advance for ideas.

 

1 ACCEPTED SOLUTION
cdnjj
Frequent Visitor

Magic!  Corerct, I am building out a calculated column.  

 

Thank you.  

 

 

View solution in original post

3 REPLIES 3
Daniil
Kudo Kingpin
Kudo Kingpin

@cdnjj, do you want to create a calculated column?

 

If yes, here is what you can try:

Customer Transaction Count =
COUNTROWS (
    GROUPBY (
        FILTER (
            SalesLineData,
            DailySalesSummary[Date] = SalesLineData[Date]
        ),
        SalesLineData[TransactionNumber]
    )
)
cdnjj
Frequent Visitor

Magic!  Corerct, I am building out a calculated column.  

 

Thank you.  

 

 

TomMartens
Super User
Super User

Hey,

 

It would be really helpful if you would provide sample data.

 

But my first idea would be

 

COUNTROWS(
  VALUES(SalesLineData[TransactionNumber])
)

Hope this helps

 

Regards

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

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.