The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
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
1 | India | TV | 1/1/2023 | 1/6/2023 |
2 | India | Fridge | 1/1/2023 | 1/6/2023 |
3 | India | Monitor | 1/1/2023 | 1/6/2023 |
1 | Australia | TV | 1/1/2023 | 1/6/2023 |
2 | Australia | Fridge | 1/1/2023 | 1/6/2023 |
3 | Australia | Monitor | 1/1/2023 | 1/6/2023 |
1 | United Kingdom | TV | 1/1/2023 | 1/6/2023 |
2 | United Kingdom | Fridge | 1/1/2023 | 1/6/2023 |
3 | United Kingdom | Monitor | 1/1/2023 | 1/6/2023 |
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.
Thanks in Advance
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]))
User | Count |
---|---|
58 | |
54 | |
53 | |
49 | |
30 |
User | Count |
---|---|
177 | |
88 | |
70 | |
48 | |
48 |