Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Objective: Create a DAX measure which gives me a unique row count based on 'Product' column. The condition is based on users, usage and month column.
Problem: For condition, Users = 0 and Usage = 0, the result of my row count is 2 because my DAX seems to calculate count of Product A + Product B. The expected value should be 1.
Expected Result: I want my DAX to give me a distinct/unique count of Products if all USERS & USAGE & All MONTHS for each product is equal to 0. The expected count value should be 1 (Product B) based on my sample data below.
I have Table A with the following columns and values:
Product | Month | Users | Usage
A | 1/1/2022 | 0 | 0
A | 2/1/2022 | 1 | 1
A | 3/1/2022 | 1 | 1
B | 1/1/2022 | 0 | 0
B | 2/1/2022 | 0 | 0
B | 3/1/2022 | 0 | 0
C | 1/1/2022 | 1 | 1
C | 2/1/2022 | 1 | 1
C | 3/1/2022 | 1 | 1
Here's my current DAX Measure that is not giving me the required result count:
Unused Products =
CALCULATE
(DISTINCTCOUNT('TableA'[Products]),
'TableA'[Users] == 0 && 'TableA'[Usage] == 0
) + 0
Can you please help me fix my DAX? I appreciate all your help in advance.
Solved! Go to Solution.
Zero Usage Products =
var a = SUMMARIZE('TableA',[Product],"r",COUNTROWS('TableA'),"z",CALCULATE(COUNTROWS('TableA'),'TableA'[Usage]=0,'TableA'[Users]=0))
return COUNTROWS(filter(a,[r]=[z]))
Zero Usage Products =
var a = SUMMARIZE('TableA',[Product],"r",COUNTROWS('TableA'),"z",CALCULATE(COUNTROWS('TableA'),'TableA'[Usage]=0,'TableA'[Users]=0))
return COUNTROWS(filter(a,[r]=[z]))
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
38 | |
25 | |
25 | |
23 | |
21 |
User | Count |
---|---|
36 | |
24 | |
21 | |
18 | |
17 |