Forum Discussion
Frequency table for values in column selected by parameter
- 3 years ago
So, depending on what you need, this is actually a pretty straightforward task. I'm not sure how to create a table that exists in the model, but to make it as a visualization is no big deal. Use a count of all the rows or unique IDs or whatever and the column from the parameter. I should have tried this initially.
Ritaf1983 Do you know of a way for me to upload a pbix file and demonstrate the parameter? I'm guessing that since you're a community champion you must.
---edit---
Here is a link to the pbix in google drive.
https://drive.google.com/file/d/1c6ReKmFrMUyguKDGKuPyIlAuX4h2ABWu/view?usp=sharing
If not then the "example" would be this.
| Column 1 | Column 2 |
| A | 1 |
| B | 4 |
| C | 5 |
| B | 6 |
| B | 4 |
Result when Column 1 is chosen in the paramter.
| Value | Count |
| A | 1 |
| B | 3 |
| C | 1 |
I was able to create a frequency table for a specific column, using:
FrequencyTable = SUMMARIZE(Table, Table[Column 1], "Count", COUNTROWS(Table)
but trying to create a dynamic table by simply switching out the table/columns names for the corresponding parameter/paramter_column names but that returns the following error:
Parameter [Parameter Column 1] is part of composite key, but not all columns of the composite key are included in the expression or its dependent expression.
The next thing I'm going to try is to use SWITCH.