Forum Discussion
Can Measure Result be used for Creating a Chart?
Hi,
I have a data table as below. I used measure to calculate the Last Year Sales numbers and categorized the Sales Trend. For the Sales Trend, if this year sales is bigger than last year sales, then the trand is Savings, otherwise Headwinds.
Anyone can tell me how to create the chart as I copied below from the Sales Trend data? I had a hard time to find how Measure result can be used for creating a chart.
Thanks for your insights.
17 Replies
- amitchandakSuper User
Anonymous , One is you need have date table with Month and month year and joined with your date.
You can use stacked line visual
Use Month from date sales trend as a legend.
refer: https://docs.microsoft.com/en-us/power-bi/visuals/power-bi-visualization-combo-chart
Can you share sample data and sample output in table format?
- AnonymousNot applicable
Hi Amit,
Thanks for your prompt respond.
Unfortinatelly your advice doesn't work. As I mentioned earlier, the Sales Trend data is a result of measure and it cannot be used in colums series to generate the chart.
How can I attach the data sample data here?
- AnonymousNot applicable
Hi Anonymous
I build two table to have a test.
This year Table:
Last year Table:
Then I use measure to add Last Year Sale into This year table and get sales gap between last year and this year..
Last Year Sales = CALCULATE(SUM('Last year'[Last Year Sale]),FILTER('Last year','Last year'[Date]=MAX('This year'[Date])))Sales gap = SUM('This year'[This Year Sales])-[Last Year Sales]It is not supported to use measures into “Legend”. So we need to create a calculated column of Sales Trend.
Sales Trend = IF('This year'[This Year Sales]>[Last Year Sales],"Savings","Headwinds")Then we build a stack column chart, result is as below.
Due to I don’t know the value you use to build the line chart, if this reply still couldn’t help you to solve your problem, you may provide me the calculate logic of the line chart and more details about your issue just like share me a screen shot or share your pbix file by onedrive for business.
You can download the pbix file from this link: Can Measure Result be used for Creating a Chart?
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AnonymousNot applicable
Hi Anonymous
Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your onedrive business.
Best Regards,
Rico Zhou
- AnonymousNot applicable
Hi Rico,
Thanks for the insights.
When I take out the country column from the table you created, the SKU list and sales numbers do not summ up. How to make it summ up, including the Sales Trend?
- tex628Community Champion
Anonymous added a few more rows to the model for the example. His solutions should still be correct, I removed the rows for you in the file attached below.