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
Anonymous
Not applicable

Count DAX by grouping more than one column

Hi,

 

There are two table CUSTEROUTE and JOURNEYDETAILS.

In CUSTEROUTE (custID and routeID) and in JOURNEYDETAILS (assignmentDate) columns are there.

 

i want to find out the Count of Customer by grouping on three columns (custID,routeID and assignmentDate).

 

i tried to write my dax as below. but it is not working. please help me in writing correct dax to get the above requirement.

 

Measure = CALCULATE(countx(CUSTEROUTE ,COUNT(CUSTEROUTE [dw_cust_id])),GROUPBY(CUSTEROUTE ,[routeID],[custID ]),
GROUPBY(JOURNEYDETAILS ,[assignmentDate]))
 
Thanks

 

 

3 REPLIES 3
v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

Kindly share your sample data and excepted result to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
amitchandak
Super User
Super User

Try First, in var, do the group by and use that in calculate to sum

 

Var Tab1 = Groupby(,,,,"Var1",Count())

 

Then

calculate(sum(Tab1[Var1]))

Anonymous
Not applicable

Measure = var tab1 = GROUPBY(CUSTEROUTE,CUSTEROUTE[dw_cust_id])                                                                                              var tab2 = GROUPBY(CUSTEROUTE,CUSTEROUTE[dw_route_id])                                                                                                               var tab3 = GROUPBY(Journey_Plan,Journey_Plan[Assignment_Date])                                                                                                      return                                                           CALCULATE(SUMX(Customer_Route_Association,Customer_Route_Association[dw_cust_id]),tab1,tab2,tab3)
 
i tried as your idea..this is also not giving correct value
 
Thank you

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.