The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi there,
sorry for this beeing complicated but I try to explain my problem in detail
I wrote a measure to find out how many Distinct values are found in column in temporary table that is created out of another key column in the same table.
That temporary table is built up by using a FILTER() Function. My measure looks like this:
Solved! Go to Solution.
me again, I tried a bit and now it works with this here:
distinct Counter =
VAR __Column = [ColumnWithDuplikateValues])
VAR __Table = SELECTCOLUMNS(FILTER('TABLE_X', [ColumnWithDuplikateValues] = __Column),"__Column",[ColumnWithDistinctValues])
VAR __Result = COUNTROWS(DISTINCT(__Table))
RETURN
__Result
Just delete the MAX in the first row and the [__Column] in the COUNTROWS(DISTINCT( Function
and now it works fine 🙂
thank you very much!
@Anonymous Try this:
distinct Counter =
VAR __Column = MAX('TABLE_X'[ColumnWithDuplikateValues])
VAR __Table = SELECTCOLUMNS(FILTER('TABLE_X', [ColumnWithDuplikateValues] = __Column),"__Column",[ColumnWithDistinctValues])
VAR __Result = COUNTROWS(DISTINCT(__Table, [__Column]))
RETURN
__Result
me again, I tried a bit and now it works with this here:
distinct Counter =
VAR __Column = [ColumnWithDuplikateValues])
VAR __Table = SELECTCOLUMNS(FILTER('TABLE_X', [ColumnWithDuplikateValues] = __Column),"__Column",[ColumnWithDistinctValues])
VAR __Result = COUNTROWS(DISTINCT(__Table))
RETURN
__Result
Just delete the MAX in the first row and the [__Column] in the COUNTROWS(DISTINCT( Function
and now it works fine 🙂
thank you very much!
thanks for your suggestion.
The problem is I get an error when I use your code for a calculated column. the error says:
Too many argemtns passed --> problem is this here:
VAR __Result = COUNTROWS(DISTINCT(__Table, [__Column]))
I can only pass the __Table to this function. But now I get value cound 1 for everything so I think it does not work
User | Count |
---|---|
79 | |
73 | |
39 | |
30 | |
28 |
User | Count |
---|---|
108 | |
99 | |
55 | |
49 | |
45 |