Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Adi57
New Member

create a line chart to show today data , 3 months movement and 12 movement in form of line chart

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

2 REPLIES 2
Adi57
New Member

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

Adi57_0-1715939462875.png

 

Anonymous
Not applicable

Hi @Adi57 ,

Based on my testing, please try the following methods:

1.Create the simple table.

vjiewumsft_0-1715934663439.png

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.

vjiewumsft_1-1715934676207.png

5.Set the Bars color.

vjiewumsft_2-1715934953714.png

vjiewumsft_3-1715934960956.png

6.The result is shown below.

vjiewumsft_4-1715934981238.png

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.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.