Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
hello,
trying to compare a count of multiple transaction vs single transactions.
i have a table with 2 columns, first one is GATEVISITNUMBER, second column is NBR
GATEVISITNUMBER is the primary key, and NBR is a unique number that represent different transaction associated with GATEVISITNUMBERS
for example:
GATEVISITNUMBER NBR
1 1
1 2
2 3
3 4
4 5
4 6
5 7
my measures:
Solved! Go to Solution.
Please try this small change instead. There is something called context transition that happens with you use a measure in your FILTER evaluation. It is a good thing but, since you are filtering the whole table, a filter is created on both columns and every row returns 1. That is what your first one gets all rows and your second one gets none. To get your desired result, you just want to filter the one column.
single transaction =
COUNTROWS(
FILTER (
DISTINCT ( N4_TruckTransactions[GATEVISITNUMBER] ),
[count nbr measure] = 1
)
)
And then use same but with = 2 for second measure
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Please try this small change instead. There is something called context transition that happens with you use a measure in your FILTER evaluation. It is a good thing but, since you are filtering the whole table, a filter is created on both columns and every row returns 1. That is what your first one gets all rows and your second one gets none. To get your desired result, you just want to filter the one column.
single transaction =
COUNTROWS(
FILTER (
DISTINCT ( N4_TruckTransactions[GATEVISITNUMBER] ),
[count nbr measure] = 1
)
)
And then use same but with = 2 for second measure
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
thanks Pat ,
it works!
😀👍
but can you explain a little more on
"a filter is created on both columns and every row returns"
still don't understand why first measure returns all rows and second returns blanks.
i first thought calculate() and filter() always goes together, but apperently not.
and when do I need to use the calculate() ?
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
99 | |
76 | |
64 | |
58 |
User | Count |
---|---|
148 | |
113 | |
97 | |
84 | |
67 |