Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
I want to create total sales data for products as x axis and sales value as axis.
now i want to show current data for total sales as red dot and rolling 12 months movement as black bar and rolling 3 months as orange bar - so in a single graph, we can see everything
i was able to achieve current data and 12 m using error bars, but failed to get a proper results for the 3 months
Thanks Wisdom Wu- but i m trying to build somethings like this where red dot is today, orange bar is 3 months and black is 12 months - each such line refers to a different product
Hi @Adi57 ,
Based on my testing, please try the following methods:
1.Create the simple table.
2.Create the new measure to calculate today, 3 months and 12 months.
Today sales = CALCULATE (
SUM ('Table'[Sales]),
FILTER (
ALL ('Table'),
'Table'[Date] = TODAY()
)
)
3 months sales =
VAR mon = MONTH(TODAY())
var three_mon = CALCULATE (
SUM ('Table'[Sales]),
FILTER (
ALL ('Table'),
'Table'[Year] = YEAR(TODAY())
&& 'Table'[Month] <= MONTH(TODAY()) && 'Table'[Month] > MONTH(TODAY()) - 3
)
)
VAR less_three = CALCULATE (
SUM ('Table'[Sales]),
FILTER (
ALL ('Table'),
'Table'[Year] = YEAR(TODAY()) || ('Table'[Year] = YEAR(TODAY()) - 1 && 'Table'[Month] > MONTH(TODAY()) + 9)
)
)
RETURN
IF(mon < 3, less_three, three_mon)
12 months move =
VAR mont = MONTH(TODAY())
RETURN
CALCULATE (
SUM ('Table'[Sales]),
FILTER (
ALL ('Table'),
'Table'[Year] = YEAR(TODAY()) || ('Table'[Year] = YEAR(TODAY()) - 1 && 'Table'[Month] > mont)
)
)
3.Create the new measure to show different sales.
Total sales =
SWITCH(
TRUE(),
SELECTEDVALUE('Table 1'[Period]) = "today", [Today sales],
SELECTEDVALUE('Table 1'[Period]) = "3 months", [3 months sales],
SELECTEDVALUE('Table 1'[Period]) = "12 months", [12 months move]
)
4.Drag two measure into the bar chart.
5.Set the Bars color.
6.The result is shown below.
Best Regards,
Wisdom Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
90 | |
87 | |
80 | |
69 | |
69 |
User | Count |
---|---|
226 | |
129 | |
119 | |
83 | |
77 |