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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Ricky97
Regular Visitor

Visualizing Case Trends with Subscription Start and End Dates for Accounts

I need to track the total number of cases raised by an account, where each account will raise multiple subscription requests, each with a start and end date. I'd like to create a plot that shows the total number of cases raised by the account over time, with subscription start and end dates marked as lines. This will help identify trends in case counts and allow for comparisons during the subscription periods.

I have attached a sample Excel file where each case is tagged to a subscription name based on the case creation date (if the creation date falls between the subscriptionโ€™s start and end dates)

 

Attaching the prototype here :

Ricky97_0-1733125145077.png

 

I have attached the files in tableau community since I am unable to attach it her. Your help is much appreciated.

https://community.tableau.com/s/question/0D5cw000006RpqzCAC/visualizing-case-trends-with-subscriptio...

1 ACCEPTED SOLUTION
shafiz_p
Super User
Super User

Hi @Ricky97 
In power bi line chart you would not be able to create a x axis constant line for categorical or text label. If you have number in X axis, then you can create constant line to identify subscription start and end date. But in your case it is a categorical.

You need to use custome visual which provide such functionality.

However, you could get similar artifact using Line and Stacked column chart. See Some of the examples:

shafiz_p_0-1733139188050.pngshafiz_p_1-1733139254451.png

Here is the data model:

shafiz_p_2-1733139602780.png

 

Created few extra column in Subscription table, See code below:

MonthYearSubscriptionTable = FORMAT('Subscription'[START DATE], "MMM-YYYY")

MonthYearEndDate = FORMAT('Subscription'[END DATE], "MMM-YYYY")

Image:

shafiz_p_3-1733139776182.png

 

 

To create a column for Subscription Start Date, Use this measure:

CheckMonthYearMatch = 
IF(
    CALCULATE(
        COUNTROWS('Subscription'),
        'Subscription'[MonthYearSubscriptionTable] = SELECTEDVALUE('Calendar'[Month-Year])
    ) > 0,
    7,
    BLANK()
)

 To create a column for Subscription End Date, Use this measure:

CheckMonthYearMatchEnd = 
IF(
    CALCULATE(
        COUNTROWS('Subscription'),
        'Subscription'[MonthYearEndDate] = SELECTEDVALUE('Calendar'[Month-Year])
    ) > 0,
    7, // You could use measure to get the max count within all month, to set the hight of the column
    BLANK()
)

 

For custom data label for columns, Create below measure for Subscription Start Date:

CheckMonthYearMatchStartDate = 
IF(
    CALCULATE(
        COUNTROWS('Subscription'),
        'Subscription'[MonthYearSubscriptionTable] = SELECTEDVALUE('Calendar'[Month-Year])
    ) > 0,
    "Start Date : " & FORMAT(MINX(
        FILTER(
            'Subscription',
            'Subscription'[MonthYearSubscriptionTable] = SELECTEDVALUE('Calendar'[Month-Year])
        ),
        'Subscription'[START DATE]
    ), "MM-DD-YY") & " " &
    MINX(
        FILTER(
            'Subscription',
            'Subscription'[MonthYearSubscriptionTable] = SELECTEDVALUE('Calendar'[Month-Year])
        ),
        'Subscription'[CR Name]
    ),
    BLANK()
)

 

For Subscription End Date:

CheckMonthYearMatchEndDate = 
IF(
    CALCULATE(
        COUNTROWS('Subscription'),
        'Subscription'[MonthYearEndDate] = SELECTEDVALUE('Calendar'[Month-Year])
    ) > 0,
    "End Date : " & FORMAT(MINX(
        FILTER(
            'Subscription',
            'Subscription'[MonthYearEndDate] = SELECTEDVALUE('Calendar'[Month-Year])
        ),
        'Subscription'[END DATE]
    ), "MM-DD-YY") & " " & 
    MINX(
        FILTER(
            'Subscription',
            'Subscription'[MonthYearEndDate] = SELECTEDVALUE('Calendar'[Month-Year])
        ),
        'Subscription'[CR Name]
    ),
    BLANK()
)

 

 

Place measure to create Visual column in the visual Column-Y Axis, and CountCase measure in the Line Y-Axis:

shafiz_p_4-1733139885791.png

Update data labels with the corresponding measure, see image :

shafiz_p_5-1733139998792.png

 

PBIX : 

 

 

Hope this helps!!

If this solved your problem, please accept it as a solution and a kudos!!

Best Regards,
Shahariar Hafiz

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi @Ricky97 ,

 

Did @shafiz_p  @danextian reply solve your problem? If so, please mark it as the correct solution, and point out if the problem persists.

 

Best regards,

Adamk Kong

shafiz_p
Super User
Super User

Hi @Ricky97 
In power bi line chart you would not be able to create a x axis constant line for categorical or text label. If you have number in X axis, then you can create constant line to identify subscription start and end date. But in your case it is a categorical.

You need to use custome visual which provide such functionality.

However, you could get similar artifact using Line and Stacked column chart. See Some of the examples:

shafiz_p_0-1733139188050.pngshafiz_p_1-1733139254451.png

Here is the data model:

shafiz_p_2-1733139602780.png

 

Created few extra column in Subscription table, See code below:

MonthYearSubscriptionTable = FORMAT('Subscription'[START DATE], "MMM-YYYY")

MonthYearEndDate = FORMAT('Subscription'[END DATE], "MMM-YYYY")

Image:

shafiz_p_3-1733139776182.png

 

 

To create a column for Subscription Start Date, Use this measure:

CheckMonthYearMatch = 
IF(
    CALCULATE(
        COUNTROWS('Subscription'),
        'Subscription'[MonthYearSubscriptionTable] = SELECTEDVALUE('Calendar'[Month-Year])
    ) > 0,
    7,
    BLANK()
)

 To create a column for Subscription End Date, Use this measure:

CheckMonthYearMatchEnd = 
IF(
    CALCULATE(
        COUNTROWS('Subscription'),
        'Subscription'[MonthYearEndDate] = SELECTEDVALUE('Calendar'[Month-Year])
    ) > 0,
    7, // You could use measure to get the max count within all month, to set the hight of the column
    BLANK()
)

 

For custom data label for columns, Create below measure for Subscription Start Date:

CheckMonthYearMatchStartDate = 
IF(
    CALCULATE(
        COUNTROWS('Subscription'),
        'Subscription'[MonthYearSubscriptionTable] = SELECTEDVALUE('Calendar'[Month-Year])
    ) > 0,
    "Start Date : " & FORMAT(MINX(
        FILTER(
            'Subscription',
            'Subscription'[MonthYearSubscriptionTable] = SELECTEDVALUE('Calendar'[Month-Year])
        ),
        'Subscription'[START DATE]
    ), "MM-DD-YY") & " " &
    MINX(
        FILTER(
            'Subscription',
            'Subscription'[MonthYearSubscriptionTable] = SELECTEDVALUE('Calendar'[Month-Year])
        ),
        'Subscription'[CR Name]
    ),
    BLANK()
)

 

For Subscription End Date:

CheckMonthYearMatchEndDate = 
IF(
    CALCULATE(
        COUNTROWS('Subscription'),
        'Subscription'[MonthYearEndDate] = SELECTEDVALUE('Calendar'[Month-Year])
    ) > 0,
    "End Date : " & FORMAT(MINX(
        FILTER(
            'Subscription',
            'Subscription'[MonthYearEndDate] = SELECTEDVALUE('Calendar'[Month-Year])
        ),
        'Subscription'[END DATE]
    ), "MM-DD-YY") & " " & 
    MINX(
        FILTER(
            'Subscription',
            'Subscription'[MonthYearEndDate] = SELECTEDVALUE('Calendar'[Month-Year])
        ),
        'Subscription'[CR Name]
    ),
    BLANK()
)

 

 

Place measure to create Visual column in the visual Column-Y Axis, and CountCase measure in the Line Y-Axis:

shafiz_p_4-1733139885791.png

Update data labels with the corresponding measure, see image :

shafiz_p_5-1733139998792.png

 

PBIX : 

 

 

Hope this helps!!

If this solved your problem, please accept it as a solution and a kudos!!

Best Regards,
Shahariar Hafiz

danextian
Super User
Super User

Hi @Ricky97 

Try the following measure

 

Case Count = 
SUMX (
    ADDCOLUMNS (
        SUMMARIZE (
            SubsciptionDate,
            SubsciptionDate[ACCOUNT],
            SubsciptionDate[CR Name],
            SubsciptionDate[START DATE],
            SubsciptionDate[END DATE]
        ),
        "@Count",
            COUNTROWS (
                FILTER (
                    VALUES ( 'Case'[Case Create] ),
                    'Case'[Case Create] >= [START DATE]
                        && 'Case'[Case Create] <= [END DATE]
                )
            )
    ),
    [@Count]
)

danextian_0-1733124763151.png

Please see attached pbix for the details.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and Iโ€™ll forget; show me and I may remember; involve me and Iโ€™ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hi @danextian , Thank you for formatting it into a table. However, my requirement is slightly different. Could you guide me on how to create a line chart with overlapping subscription start and end dates as refernece lines? Attached the image for reference.

Ricky97_0-1733124998424.png

 

You will need a custom viz for that. I don't  think there's one that exists.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and Iโ€™ll forget; show me and I may remember; involve me and Iโ€™ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors