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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
yashwant101
Helper III
Helper III

Need vertical line in bar graph

Hi all,

 

I am showing a bar graph to the clients. The graph is a monthly chart with months on x-axis. I need a vertical dashed or dotted line after one specific month. I cnnot put any shape or image because there is scroll in my chart. Is it possible to do it?

 

Any help is highly appreciated!

 

Regards,

Yashwant

1 ACCEPTED SOLUTION

Hi @yashwant101 - i have used with some sample data and in line chart you can use reference line and based on date create a measure and add conditional formatting.

 

rajendraongole1_0-1716901541693.png

rajendraongole1_1-1716901732688.png

 

can you try the above logic

 

SignificantChange1 =
VAR CurrentMonthValue = SUM(financials[Profit])
VAR PreviousMonthValue = CALCULATE(SUM(financials[Profit]), DATEADD(financials[Date], -1, MONTH))
VAR PercentageChange =
    IF(
        NOT ISBLANK(PreviousMonthValue),
        DIVIDE(CurrentMonthValue - PreviousMonthValue, PreviousMonthValue, 0),
        0
    )
RETURN
    IF(PercentageChange >= 0.2, 1, 0)  -- Assuming a 20% change is significant
 
 
Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

5 REPLIES 5
rajendraongole1
Super User
Super User

Hi @yashwant101 - Create a calculated column in your date table that identifies the specific month after which you want to add the vertical line. This calculated column can contain a flag or indicator for the specific month.

 

LineIndicator = IF('DateTable'[Month] > DATE(2023, 5, 1), 1, 0)

 

example: i have taken may month

Drag the LineIndicator calculated column to the "Values" or "Legend" field well.Change the aggregation method to "Don't summarize" or "Don't summarize (single)" depending on your Power BI version.Format the line as a dashed or dotted line.

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Hi @rajendraongole1 ,

 

Can you please provide a file with the implementation? I am having issues implemeting it.

 

Regards,

Yashwant

Hi @yashwant101 Expecting the sample file from your end, because you know the data and expectations, share it with us,will check from our end.

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Hi @rajendraongole1 ,
I have not been allowed to share file yet but I can attach a screenshot:

Below is the expected graph:

yashwant101_0-1716899124239.png

In the above line and bar chart, we have a vertical dashed line for Oct-2023. That indictes that there was a significant change related to the orgnization in that month. I want to do this in Power BI for specific month.

Hi @yashwant101 - i have used with some sample data and in line chart you can use reference line and based on date create a measure and add conditional formatting.

 

rajendraongole1_0-1716901541693.png

rajendraongole1_1-1716901732688.png

 

can you try the above logic

 

SignificantChange1 =
VAR CurrentMonthValue = SUM(financials[Profit])
VAR PreviousMonthValue = CALCULATE(SUM(financials[Profit]), DATEADD(financials[Date], -1, MONTH))
VAR PercentageChange =
    IF(
        NOT ISBLANK(PreviousMonthValue),
        DIVIDE(CurrentMonthValue - PreviousMonthValue, PreviousMonthValue, 0),
        0
    )
RETURN
    IF(PercentageChange >= 0.2, 1, 0)  -- Assuming a 20% change is significant
 
 
Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

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

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.