Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi there!
I have 2 tables that have a quantity and a cost. Ideally, they would be in one table, but the calculations are too complex to have them combined.
In this simplified example, I have 2 tables,
Table Cats | ||
Date | Cat Amount | Cat Cost |
6/30/2018 | 4 | 32 |
7/1/2018 | 4 | 34 |
7/2/2018 | 4 | 44 |
7/3/2018 | 3 | 22 |
7/4/2018 | 6 | 35 |
7/5/2018 | 2 | 21 |
7/6/2018 | 4 | 45 |
Table Dogs | ||
Date | Dog Amount | Dog Cost |
6/30/2018 | 3 | 987 |
7/1/2018 | 4 | 76 |
7/2/2018 | 5 | 78 |
7/3/2018 | 4 | 77 |
7/4/2018 | 16 | 788 |
7/5/2018 | 8 | 776 |
7/6/2018 | 4 | 88 |
I would like to have one bar chart showing sales per day. The result would be spliced by either cat OR dog, depending what was chosen on the splicer. How can I achieve this with a dax measure? Note, I cannot merge queries.
Any help is much appreciated!
Cheers,
Corey
Solved! Go to Solution.
Found a way!
Hi @Anonymous
Please look at my test, steps are below
In query editor
1.Merge queries as new
2.in the Merge 1 table, expand columns from table Dogs
3. add two custom columns to calculate sales for Dogs and Cats
4.select the two custom columns "Sales for Cat" and "Sales for Dog", then select "unpivot only selected columns"
5.add a conditional column to define which categoary each value belong to, Dog or Cat.
6.add columns in the chart
Best Regards
Maggie
Thanks for your reply Maggie,
I was hoping to do it without merging queries since I have many calculations that would not work in a merged query.
I appreciate your time!
There may not be a way...
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
116 | |
102 | |
78 | |
77 | |
49 |
User | Count |
---|---|
145 | |
108 | |
107 | |
89 | |
61 |