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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Eryka90
Frequent Visitor

How to create a stacked bar chart with different categories and monitor with date

Hi All,

 

I would like to create stacked chart to monitor my due date status (Today Due, Not Due, Pass Due). Here is sample of my data

 

PO NumberNet Due Date
SL07868581INV11/18/2023
SL13421911/28/2023
SLI-4009453011/21/2023
SLI4022384411/5/2023
SLI4022391011/6/2023
SLI4022425811/13/2023
SLI4022447011/18/2023
SLI4022454311/19/2023
SLI4022460011/15/2023
SLI4022460211/20/2023
SLI4102066111/1/2023
SLI4102164511/30/2023
SLI4102917311/9/2023
SLI4102943611/30/2023
SLI4181850711/12/2023
SLI4181898511/13/2023

 

I did create a DAX for the status as below

New_Due Status =
IF(ISBLANK('Pending Items'[Net Due Date]), "Due Date Blank",
    IF('Pending Items'[Net Due Date] > TODAY(), "Not Due",
        IF('Pending Items'[Net Due Date] < TODAY(), "Past Due", "Due Today")
    )
)
However my chart showing like this
Eryka90_0-1700031344964.png

 

I'm looking is there a way to create stacked chart as below

Eryka90_1-1700031520893.png

Thank you for your help

1 REPLY 1
Ritaf1983
Super User
Super User

Hi @Eryka90 

Assuming I understand correctly, the goal is to display the number of invoices in the system for each day, categorized by status.

In addition to the classification column you added, you need to calculate the cumulative quantity.

Since your data for today is all in the same status because 2023 is all before today, I have changed the data to illustrate the solution.

Ritaf1983_0-1713517944542.png

The first step is the date table :

Ritaf1983_1-1713518006085.png

Ritaf1983_2-1713518045379.png

Ritaf1983_3-1713518065585.png

Then I created a measure :

count_invoices =
VAR LastVisibleDate =
    MAX ( 'dim_date'[Date] )
VAR FirstVisibleDate =
    MIN ( 'dim_date'[Date] )
VAR LastDateWithSales =
    CALCULATE (
        MAX ( 'Table'[Net Due Date] ),
        REMOVEFILTERS ()  
    )
VAR Result =
    IF (
        FirstVisibleDate <= LastDateWithSales,
        CALCULATE (
           COUNTROWS('Table'),
            'dim_date'[Date] <= LastVisibleDate
        )
    )
RETURN
    Result
Ritaf1983_4-1713518126951.png

the last step is to put all the data in the desired graph :

Ritaf1983_5-1713518237073.png

The pbix is attached you can follow my steps

More information about the date table is here :

https://radacad.com/all-in-one-script-to-create-calendar-table-or-date-dimension-using-dax-in-power-...

Running totals here :

https://www.daxpatterns.com/cumulative-total/

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.