Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers!
Enter the sweepstakes now!See when key Fabric features will launch and what’s already live, all in one place and always up to date. Explore the new Fabric roadmap
Dear Community,
I need your help.
I have a table in which I calculate the range of each article. Lets assume that I have two different itmes with to different ranges.
Item1 Range of 3 and Item2 with a Range of 1.
Now I have a second table. This table has different limits. Does are for example:
0>2<=
and
2><=5.
What I want to do know is,I wanto to make a distinctcount on the first table, namely on the Item column.And then,
bases on the range specified in table1, I would like to assign the count to the correct limit in table2.
Here is an example from my current Power BI with my goal.

Solved! Go to Solution.
Hi @Danny090890 ,
Please try this measure.
Measure =
VAR _selectvalue = SELECTEDVALUE('Table 1'[Border])
VAR _result_0_2 = CALCULATE(COUNT('Table 2'[Range]),FILTER('Table 2','Table 2'[Range]>=1&&'Table 2'[Range]<3)) + 0
VAR _result_2_5 = CALCULATE(COUNT('Table 2'[Range]),FILTER('Table 2','Table 2'[Range]>=3&&'Table 2'[Range]<6)) + 0
VAR _result_5_8 = CALCULATE(COUNT('Table 2'[Range]),FILTER('Table 2','Table 2'[Range]>=6&&'Table 2'[Range]<9)) + 0
VAR _result_8 = CALCULATE(COUNT('Table 2'[Range]),FILTER('Table 2','Table 2'[Range]>=9&&'Table 2'[Range]<999)) + 0
VAR _result =
SWITCH(
_selectvalue,
"0><=2",_result_0_2,
"2><=5",_result_2_5,
"5><=8",_result_5_8,
"8>",_result_8
)
RETURN
_result
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data
Hello,
thanks for the answer I will paste my table and solution bellow.
Like I said. I want to make a count on Itmes. And on the dependence of the range I want to asign the
DISTINCTCOUNT of the items to the right border.
Data Table 1
Border | Lower | Upper |
0><=2 | 1 | 2 |
0><=2 | 2 | 3 |
2><=5 | 3 | 4 |
2><=5 | 4 | 5 |
2><=5 | 5 | 6 |
5><=8 | 6 | 7 |
5><=8 | 7 | 8 |
5><=8 | 8 | 9 |
8> | 9 | 999 |
Data Table 2
Item | Location | Range |
00253/00 | P305 | 1 |
00253/00 | P203 | 2 |
00171/03 | P305 | 6 |
00563/02 | P305 | 14 |
00129/00 | P203 | 1 |
00129/00 | P305 | 4 |
Solution (Output):
Border | Count of Itmes |
0><=2 | 0 |
2><=5 | 2 |
5><=8 | 1 |
8> | 1 |
Solution Filter on Location P305:
Border | Count of Itmes |
0><=2 | 1 |
2><=5 | 1 |
5><=8 | 1 |
8> | 1 |
Hi @Danny090890 ,
Please try this measure.
Measure =
VAR _selectvalue = SELECTEDVALUE('Table 1'[Border])
VAR _result_0_2 = CALCULATE(COUNT('Table 2'[Range]),FILTER('Table 2','Table 2'[Range]>=1&&'Table 2'[Range]<3)) + 0
VAR _result_2_5 = CALCULATE(COUNT('Table 2'[Range]),FILTER('Table 2','Table 2'[Range]>=3&&'Table 2'[Range]<6)) + 0
VAR _result_5_8 = CALCULATE(COUNT('Table 2'[Range]),FILTER('Table 2','Table 2'[Range]>=6&&'Table 2'[Range]<9)) + 0
VAR _result_8 = CALCULATE(COUNT('Table 2'[Range]),FILTER('Table 2','Table 2'[Range]>=9&&'Table 2'[Range]<999)) + 0
VAR _result =
SWITCH(
_selectvalue,
"0><=2",_result_0_2,
"2><=5",_result_2_5,
"5><=8",_result_5_8,
"8>",_result_8
)
RETURN
_result
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data
Please provide sanitized sample data that fully covers your issue. I can only help you with meaningful sample data.
Please paste the data into a table in your post or use one of the file services like OneDrive or Google Drive.
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.
https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523
User | Count |
---|---|
19 | |
18 | |
16 | |
13 | |
13 |
User | Count |
---|---|
9 | |
8 | |
8 | |
7 | |
6 |