Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
I've got the date as shown below:
Table | ID |
1 | 564080 |
1 | 648747 |
1 | 701842 |
1 | 701858 |
1 | 701859 |
1 | 701860 |
2 | 760287 |
2 | 760304 |
2 | 760371 |
2 | 760394 |
2 | 760397 |
2 | 760400 |
2 | 760514 |
I nees to get tow measures:
1-The Distinct count of IDs where table field equals 1
2-The Distinct count of IDs where table field equals 2
I've tryed:
Measure = CALCULATE(
DISTINCTCOUNT(data[ID]),FILTER(data,data[ID]="2"))
And the count is not correct
Solved! Go to Solution.
Try then:
Measure 1 =
CALCULATE(
DISTINCTCOUNT( Data[ID] ),
REMOVEFILTERS( Data ),
Data[Type] = 1
)
Hi,
sounds simple.
If you want to visualize this in any of the P BI visual, simply DISTINCTCOUNT of IDs should work. You just need to put the column that you want to split the results by onto the visualization. The filter context will do the rest.
If you want to create separate visuals, each for each type, you can either use filters on the filter pane or add a filter argument to the `CALCULATE` function. In the first case, DISTINCTCOUNT measure would work.
For the measure that use the expression for filtering, go for this:
Measreu 1 =
CALCULATE(
DISTINCTCOUNT( Data[ID] ),
Data[Type] = 1
)
Measreu 2 =
CALCULATE(
DISTINCTCOUNT( Data[ID] ),
Data[Type] = 2
)
However, I assume there is no need to create a separate measures for your case. Create a DISTINCTCOUNT measure and put it on the visualization along with the [Type] column (or any other column that you want to display with the measure).
It doesn't work, both measures show the same value:
Try then:
Measure 1 =
CALCULATE(
DISTINCTCOUNT( Data[ID] ),
REMOVEFILTERS( Data ),
Data[Type] = 1
)
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
15 | |
10 | |
10 | |
10 | |
10 |
User | Count |
---|---|
19 | |
14 | |
13 | |
11 | |
8 |