Forum Discussion
Count rows in table visual with Field Parameters
- 4 years ago
It's a two step process. Check the article at sqlbi.com . Fields parameters in Power BI - SQLBI
Unfortunately it is not (yet) possible to provide lists of columns instead of individual columns
lbendlin would you kindly create a measure for me, since I am still pretty much confused on how to do that! 🙄
Rowcount =
SWITCH(concatenatex(parameter,[Parameter],","),
"ACCOUNTING_PERIOD",COUNTROWS(SUMMARIZE(ALLSELECTED('ledger_fy22_qtr1'),[ACCOUNTING_PERIOD])),
"FISCAL_YEAR",COUNTROWS(SUMMARIZE(ALLSELECTED('ledger_fy22_qtr1'),[FISCAL_YEAR])),
COUNTROWS(SUMMARIZE(ALLSELECTED('ledger_fy22_qtr1'),[FISCAL_YEAR],[ACCOUNTING_PERIOD]))
)
- gp103 years agoAdvocate III
Hi lbendlin ,
if we have 2 field parameters on our table visual how would that measure look?
And if the Field Parameter has columns from different tables?
Imagine a table visual with field parameter like below:Measures = {("Total Sales", NAMEOF('Measures Table'[Total Sales]), 0),("Avg Sales", NAMEOF('Measures Table'[Average Sales]), 1),}
andCategories = {("Product", NAMEOF('Product Table'[Product]), 0),("Country", NAMEOF('Country Table'[Country]), 1),("Store", NAMEOF('Stores Table'[Store]), 2)}
Thanks. - lbendlin3 years agoSuper User
Same methodology. Instead of permutations for two columns your SWITCH statement needs to handle permutations over three columns.
The measures field parameters are irrelevant as they don't contribute cardinality.
- gp103 years agoAdvocate III
True, measures are irrelevant.
The thing is the different tables, not the number of columns.
So for example if I have columns from 4 different tables what would I write here?COUNTROWS(SUMMARIZE(ALLSELECTED('ledger_fy22_qtr1'),[FISCAL_YEAR],[ACCOUNTING_PERIOD])) - lbendlin3 years agoSuper User
use the same query as the visual uses when you combine these columns from different tables. SUMMARIZECOLUMNS etc.
- algunn142 years agoFrequent Visitor
This is as close as I've seen anyone get to the solution I'm looking for. In my situation, the user wants to dynamically add multiple fields from one table, but their are over 100 fields in this table and they could add any combination of fields. I'm trying to think of a way to modify your dax above to account for the endless possible variations of column selections.
I'm stumped right now, if you had any thoughts I would love to hear them! Thanks. - lbendlin1 year agoSuper User
It's all manual, and unmanageable for more than 5 parameters. You are looking at 2 to the power of parameter count permutations.