Forum Discussion
Looking up values in a column
Hi Everyone, I wanted to seek your help in my current DAX formula,
however, it says "Too many arguments were passed to the COUNTROWS function. The maximum argument count for the function is 1".
I wanted to count the occurrence of a particular variable in a column. Below is the variable I wanted to know its occurrence.
And below column where I wanted to look for the number of its recurrence. The rows in the column contains multiple variable.
I'm writing it wrong, appreciate help from the team. thank you very much!
Hi PHEstaciMa1
Here is the file with solution. https://we.tl/t-dixeoricuZ
Hope it satisfies your requirementAntecedents LSR - Tamer = VAR CurrentValue = MAX ( 'Antecedents - LSR'[Value] ) RETURN SUMX ( '2022 Gemba Online', IF ( CONTAINSSTRING ( '2022 Gemba Online'[Antecedents], CurrentValue ), 1, 0 ) )
22 Replies
- PHEstaciMa1
Helper II
amitchandak requesting help in my problem with DAX using PBI desktop. thanks!
- amitchandak
Super User
PHEstaciMa1 , better to create a new column in table1
countx(filter(Table2, Containsstring(Table2[Antecednet], Table1[Value]) ), Table2[Antecednet])
If this does not help
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.Then you can sum
- PHEstaciMa1
Helper II
Hi amitchandak I'm trying to share the PBIX but it seems there is no option in the reply to attached files. Where can I send it?
- amitchandak
Super User
PHEstaciMa1 , you can upload on onedrive or dropbox and share the link
- tamerj1
Community Champion
Hi PHEstaciMa1
you may try
Antecedents LSR = COUNTROWS ( FILTER ( '2822 Gemba Online', '2022 Gemba Online'[Antecedents] IN VALUES ( 'Antecedents LSR'[Value] ) ) )- PHEstaciMa1
Helper II
- tamerj1
Community Champion
You can upload the file to OneDrive or WeTransfer and semd the link.
- v-easonf-msft
Community Support
Hi, PHEstaciMa1
The 'Max' should be used for the first parameter in 'CONTAINSSTRING', please modify your original formula as below:
M_Antecedents LSR = COUNTROWS ( FILTER ( ALL('Antecedents - LSR'), CONTAINSSTRING ( MAX('2022 Gemba Online'[Antecedents]) , 'Antecedents - LSR'[Value] ) ) ) + 0Please check my sample file for more details.
Best Regards,
Community Support Team _ Eason- tamerj1
Community Champion
v-easonf-msft PHEstaciMa1
My understanding was acutally the opposite. Maybe I'm wrong but I thought PHEstaciMa1 wants to slice by [Value] and count how many times this value occures in the Antecedents list.
*Update..Here is v-easonf-msft sample file with my solution https://www.dropbox.com/t/GuXjvUFexvxMNo1H
Antecedents LSR - Tamer = VAR CurrentValue = MAX ( 'Antecedents - LSR'[Value] ) RETURN SUMX ( '2022 Gemba Online', IF ( CONTAINSSTRING ( '2022 Gemba Online'[Antecedents], CurrentValue ), 1, 0 ) )- PHEstaciMa1
Helper II
Hi v-easonf-msft I'll have a look at your work first and provide you feedback. yes I wanted to count the occurrences of a particular value in a column which contains other value as well. I'm sharing the PBIX thru this link.
- v-easonf-msft
Community Support
Hi, PHEstaciMa1
If your problem has been solved, please accept the reply as solution to close this thread, so that other community members will easily find the solution when they get the same issue.
If you still need help, please share more details.
Best Regards,
Community Support Team _ Eason- PHEstaciMa1
Helper II
Hi v-easonf-msft sorry, I had issues in my software last week. I tried your advise but it showed an error.
I'm trying to look for ways on how can I share my PBIX until now. Hopefully I can find a way.
- PHEstaciMa1
Helper II