March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello everyone,
I have a table with 4 columns, an id column and 3 same-kind columns containing some strings.
The purpose is for every kind of string to count how many times it has appeared in any of the 3 columns
Example :
Id | Col1 | Col2 | Col3 |
1 | A | B | A |
2 | B | C | D |
3 | D | A | B |
What I want to get is a visual (for example a table or a clustered bar chart) giving something like :
A | 3 |
B | 3 |
C | 1 |
D | 2 |
That could seem very simple, but the trouble is that in powerBi visual (Bar charts ou matrix) when you add several columns to the data fields (Rows in matrix, Group in Treemap Axis in clustered bar chart), they present the values of these columns separately, in a cartesian product, a concatenation of the 3 columns or a hierarchy.
You can define "groups" but they gather values of the same column.
So is it possible to specify an "automatic grouping" of different data columns ?
Thank you very much if someone has an idea.
Solved! Go to Solution.
Hello thenk you for ths pbix. I have added several things to you report :
1. A Date and Country columns to the data table
2. A Calendar table
3. A relationship 1-* between Calendar table and Date column, and a relationship 1-* between Id column in Data table and id in Grouping Table.
4. A bar chart showing how many Id by selected country and a date slicer (by year).
When I select a year only rows with this date are selected and the grouping table is recomputed.
The same occurs when I select only a Country from within the bar chart.
So the content of the UNION table is dynamically filtered through the id column.
How can I upload this report ? It seems I'm not allowed to do that.
Hi , @ORDR
You can take a try to create a new table and build a relationship between tables:
New Table =
UNION (
SELECTCOLUMNS ( 'Table', "ID", 'Table'[Id], "Column", 'Table'[Col1] ),
SELECTCOLUMNS ( 'Table', "ID", 'Table'[Id], "Column", 'Table'[Col2] ),
SELECTCOLUMNS ( 'Table', "ID", 'Table'[Id], "Column", 'Table'[Col3] )
)
You can check my sample pbix file for more details.
Best Regards,
Community Support Team _ Eason
Hello thenk you for ths pbix. I have added several things to you report :
1. A Date and Country columns to the data table
2. A Calendar table
3. A relationship 1-* between Calendar table and Date column, and a relationship 1-* between Id column in Data table and id in Grouping Table.
4. A bar chart showing how many Id by selected country and a date slicer (by year).
When I select a year only rows with this date are selected and the grouping table is recomputed.
The same occurs when I select only a Country from within the bar chart.
So the content of the UNION table is dynamically filtered through the id column.
How can I upload this report ? It seems I'm not allowed to do that.
Hi, @ORDR , all you need to do is to unpivot the dataset into a one-dimensional table; then use a simplest measure to count occurrence of each target value.
Count = COUNTROWS( 'Table' )
Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
Hello CNENFRNL, thank you very much for your answer.
I've already though about that but I'm not sure it gives me what I want. The matter is that my real table has a lot of columns and filters (by slicer or other visuals); is an unpivoted table automatically filtered with all filters applied to main source table ?
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
119 | |
73 | |
57 | |
57 | |
43 |
User | Count |
---|---|
177 | |
120 | |
82 | |
68 | |
57 |