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

Help needed on DAX to calculate distinct count with multiple conditions

Hello,

    I have a table with sales as shown below. This contains Country, product of sales along with from date and to date. as shown below

 

1IndiaTV1/1/20231/6/2023
2IndiaFridge1/1/20231/6/2023
3IndiaMonitor1/1/20231/6/2023
1AustraliaTV1/1/20231/6/2023
2AustraliaFridge1/1/20231/6/2023
3AustraliaMonitor1/1/20231/6/2023
1United KingdomTV1/1/20231/6/2023
2United KingdomFridge1/1/20231/6/2023
3United KingdomMonitor1/1/20231/6/2023

 

PraveenkarthikK_0-1685521292999.png

 

I have another table, where I need to count the number of items sold based on multiple conditions. I need to get a DAX column added to the second table to hold the count. I have tried DAX functions like Calculate + Filter. But it doesn't seem to work for me. It counts all rows irrespective of conditions.

 

I don't know what is wrong in this. Can some one please help me on this.

 

PraveenkarthikK_2-1685521866951.png

 

Thanks in Advance

1 REPLY 1
Ahmedx
Super User
Super User

you forgot to write ALL after FILTER

Count = CALCULATE(COUNT(Data[User]), FlLTER(ALL(Data),
Data[Country] = [Country] &&
Data[Product] = [Product] &&
Data[From Date]<= [Date] &&
Data[To Date]>=[Date]))

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.