Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi all,
I'm quite new to Power BI and I'm stuck with this issue.
I have a table similar to the following (had to create a dummy one to post here - hope it's okay)
| ID | Click | dataset |
| 1 | 1 | A |
| 2 | 1 | A |
| 3 | 0 | A |
| 4 | 1 | A |
| 5 | 0 | A |
| 1 | 1 | B |
| 2 | 0 | B |
| 3 | 0 | B |
| 4 | 0 | B |
| 1 | 0 | C |
| 2 | 1 | C |
| 3 | 0 | C |
| 4 | 1 | C |
| 5 | 0 | C |
The column dataset is to identify the data source. You'll see each ID is repeated for each dataset.
Basically what I'm trying to do is calculate the percentage of clicks in dataset B out of the number of clicks in dataset A. The result should be: 1 / 3 = 33%
Same thing but for dataset C: 2/3 = 66%
I've tried a measure like the following:
pc_clicks_b = DIVIDE(CALCULATE(COUNTROWS(Table),
FILTER(Table,Table[clicks]=1),FILTER(Table,Table[dataset]="B")),
CALCULATE(COUNTROWS(Table),FILTER(Table,Table[clicks]=1),FILTER(Table,Table[dataset]="A")))
But it's not working. This will be used in a card.
I've tried things in other questions but I haven't seen this case asked before, if it was please direct me to it and apologies for the duplicate.
Any ideas?
@amestrian , Try one of the two options
pc_clicks_b = DIVIDE(CALCULATE(COUNTROWS(Table), FILTER(Table,Table[clicks]=1 && Table[dataset]="B")),
CALCULATE(COUNTROWS(Table),FILTER(Table,Table[clicks]=1 && Table[dataset]="A")))
or
pc_clicks_b = DIVIDE(CALCULATE(COUNTROWS(Table), FILTER(all(Table),Table[clicks]=1 && Table[dataset]="B")),
CALCULATE(COUNTROWS(Table),FILTER(all(Table),Table[clicks]=1 && Table[dataset]="A")))
That seems to have worked. Strangely, however, I had to add a filter that was already in "filters on all pages", specifically to each part of the division... not sure why that happens but it works now. I wonder if it will break somehow later because of that..
Also, can you explain why using && it works but using many FILTER() functions it doesn't? It's quite funny
Edit: one more question actually, sorry. The number is right for the general casec (without slicers), however I see my slicers won't affect these two cards, not even date slicers. Why is that?
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 40 | |
| 38 | |
| 36 | |
| 29 | |
| 28 |
| User | Count |
|---|---|
| 127 | |
| 88 | |
| 78 | |
| 66 | |
| 65 |