Forum Discussion
greta
1 year agoFrequent Visitor
Parameter for a dinamic table?
Goodmorning everyone, I have a table where, for each project, to different cost types to which are associated different categories (and a total value), as an example, for a project: Cost Type | Ca...
- 1 year ago
Hi greta ,
To achieve a dynamic table in Power BI that aggregates categories into a "tot" group when they are not shared across multiple cost types, parameters alone won't work because they are static and don't respond to filter context. Instead, you'll need to use DAX to create a calculated table that evaluates which categories appear in more than one cost type and preserves them, while aggregating all others under a new "tot" category.
This approach ensures your output adapts dynamically to slicers or filters such as project selection, and correctly groups and summarizes your data for reporting purposes.
Here’s a DAX example for the calculated table:
DynamicTable = VAR SharedCategories = CALCULATETABLE ( VALUES ( 'YourTable'[Categories] ), FILTER ( 'YourTable', CALCULATE ( DISTINCTCOUNT ( 'YourTable'[Cost Type] ) ) > 1 ) ) RETURN SUMMARIZE ( ADDCOLUMNS ( 'YourTable', "NewCategory", IF ( 'YourTable'[Categories] IN SharedCategories, 'YourTable'[Categories], "tot" ) ), 'YourTable'[Cost Type], [NewCategory], "Value", SUM ( 'YourTable'[Value] ) )