Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hallo Everybody,
I just started using Power BI to produce some basic reports for our Management, but I'm not really able to produce the desired Visualizations. It should be something very simple (it takes me couple of minutes in Excel)
I have a data set of ~1000 rows (employee names) and ~50 columns (employee charachteristics such as departments, locations, sale revenue in a specific year and product, etc.). I would like to use some of these columns as slicers / filters. (see below for table example).
Some of these columns are the 2012, 2013, 2014, 2015 and 2016 sale revenues of a product per empoloyee. How am I suppose to produce a simple stacked column chart, where on the horizontal axis I have years (2012, 2013, 2014, 2015, 2016) and vertical axis a column of total sales revenue ((stucked per product)? I would also like to use some of the previous 50 columns as Slicers (e.g. select only empolyee in a certain department or a specific location/s).
In Excel I did the job by creating a Pivot Table, adding slicers, and creating a Pivot Chart. In Power BI I tried creating a new Table with DAX, but faild many times. Slicers based on the first table were not affecting my other tables neither...
Here a tabular explanation.
I would like to go from this table: --->
Employee ID | Location | Department | 2012 - product AAA - Sales rev. | 2013 - product AAA - Sales rev. | 2014 - product AAA - Sales rev. | 2015 - product AAA - Sales rev. | 2016 - product AAA - Sales rev. | 2012 - product BBB - Sales rev. | 2013 - product BBB - Sales rev. | 2014 - product BBB - Sales rev. | 2015 - product BBB - Sales rev. | 2016 - product BBB - Sales rev. | ||
1 | US | Dep. A | xxx | xxx | xxx | xxx | xxx | xxx | xxx | xxx | xxx | xxx | ||
2 | EU | Dep. A | xxx | xxx | xxx | xxx | xxx | xxx | xxx | xxx | xxx | xxx | ||
3 | EU | Dep. A | xxx | xxx | xxx | xxx | xxx | xxx | xxx | xxx | xxx | xxx | ||
4 | US | Dep. B | xxx | xxx | xxx | xxx | xxx | xxx | xxx | xxx | xxx | xxx | ||
5 | Asia | Dep. C | xxx | xxx | xxx | xxx | xxx | xxx | xxx | xxx | xxx | xxx | ||
… | … | … | … | … | … | … | … | … | … | … | … | … | ||
1000 | EU | Dep. X | xxx | xxx | xxx | xxx | xxx | xxx | xxx | xxx | xxx | xxx |
--> ...to this one (and plot it, using slicer "Emploee ID", "Department", "Location"):
Sales Revenue | 2012 | 2013 | 2014 | 2015 | 2016 |
Product AAA | xxx | xxx | xxx | xxx | xxx |
Product BBB | xxx | xxx | xxx | xxx | xxx |
Product CCC | xxx | xxx | xxx | xxx | xxx |
Any kind of help or suggestion would be highly appreciated!!
Thank you very much and kind regards,
Mladen
Solved! Go to Solution.
Hi @Mladen,
The connection and slicers I used for Table1 are not working with NewTable. Do somebody know how to fix this?
Not like measures, calculate tables/columns don't respond to user selections on the report. So your new created table won't be affected by the slicers on the your report.
After reviewing your original dataset, I would suggest you use Unpivot option under Query Editor > Transform to unpivot your "2012 - product AAA - Sales", ... , "2016 - product BBB - Sales" columns first.
Then, Split the "Attribute" column with "-".
And Rename the columns like below.
Last, you should be able to use a Matrix visual with "Product" as Rows, "Year" as Columns, and "Sales Revenue" as Values on the report.
Regards
You'll need to ensure that your tables are related to one another in your data model for the slicers from one table to affect the other. It sounds like you want a stacked column chart with Year as the horizontal axis, product as the legend and sales as the value.
Yeah, that's exacly what I would like to produce. Can someone tell me what a DAX for generating such a new table should be? Should I then estabish relationships between the tables manually?
Hi @Mladen,
The connection and slicers I used for Table1 are not working with NewTable. Do somebody know how to fix this?
Not like measures, calculate tables/columns don't respond to user selections on the report. So your new created table won't be affected by the slicers on the your report.
After reviewing your original dataset, I would suggest you use Unpivot option under Query Editor > Transform to unpivot your "2012 - product AAA - Sales", ... , "2016 - product BBB - Sales" columns first.
Then, Split the "Attribute" column with "-".
And Rename the columns like below.
Last, you should be able to use a Matrix visual with "Product" as Rows, "Year" as Columns, and "Sales Revenue" as Values on the report.
Regards
Hello,
Thanks very much for the tip. I think it goes in the right direction. Nevertheless I have more than 1000 rows (employees) and 30 columns (5 years x 6 products). When I unpivot, it increases the number of rows from 1000 to 30'000 (30*1000), it breakes other graphs I produced with my original dataset and I get errors in some rows (probably related to some errors in my original dataset). I'll try to produce the desired graph by cleaning my dataset first, then duplicate the query to preserve the original graphs and than try with the unpivot method. Hopfully it works!
Thank you very much for the support! It was very much appreciated!
User | Count |
---|---|
139 | |
113 | |
104 | |
77 | |
63 |
User | Count |
---|---|
135 | |
126 | |
110 | |
70 | |
61 |