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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
erezbenmoshe
Advocate I
Advocate I

countdistinct for each customer

I have data that looks like this:

 

Capture.JPG

 

I am struggling with writing a table that includes a line for each customer (by email), a column that include  number of orders for  in 2017 and a colum that counts 2018 orders.

 

Thanks,

Erez

1 ACCEPTED SOLUTION
erezbenmoshe
Advocate I
Advocate I

I solved it with:

Orders2017 = CALCULATE(DISTINCTCOUNT('Table'[Order Number]), FILTER('Calendar', 'Calendar'[Year]=2017))

Orders2018 = CALCULATE(DISTINCTCOUNT('Table'[Order Number]), FILTER('Calendar', 'Calendar'[Year]=2018))

 

SEgggments = SUMMARIZE (
'Table',
'Table'[UpperEmail],
"NumberofOrders2017", [Orders2017],
"NumberofOrders2018", [Orders2018],
"NumberofOrderslast5months", [Orders in last 5 months] )

View solution in original post

4 REPLIES 4
erezbenmoshe
Advocate I
Advocate I

I solved it with:

Orders2017 = CALCULATE(DISTINCTCOUNT('Table'[Order Number]), FILTER('Calendar', 'Calendar'[Year]=2017))

Orders2018 = CALCULATE(DISTINCTCOUNT('Table'[Order Number]), FILTER('Calendar', 'Calendar'[Year]=2018))

 

SEgggments = SUMMARIZE (
'Table',
'Table'[UpperEmail],
"NumberofOrders2017", [Orders2017],
"NumberofOrders2018", [Orders2018],
"NumberofOrderslast5months", [Orders in last 5 months] )

LivioLanzo
Solution Sage
Solution Sage

@erezbenmoshe

 

If you create two dimensions table one containing the unique list of emails and the other table being a usual calendar table then you just need to create a simple matrix

 


 


Did I answer your question correctly? Mark my answer as a solution!


Proud to be a Datanaut!  

Thanks but I need it for further calculations so I need it as a table.

@erezbenmoshe

 

that would not stop the analysis capabilities, it would actually enhance it

 


 


Did I answer your question correctly? Mark my answer as a solution!


Proud to be a Datanaut!  

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.