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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
IntaBruce
Helper II
Helper II

Histogram of open items by month

Hi, I want to create a histogram showing the total number and value of open orders by month.

This is NOT the number and value of orders placed or orders closed in each month but those that were still open at the end of the month, regardless of when they were placed.

My dataset has fields including: order_number, order_raised_date, order_fulfiled_date

 

Many thanks for your suggestions of how to achieve this.    Bruce

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@IntaBruce 
Take a look at these two Quick Measures as I think you want something like them.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Open-Tickets/m-p/409364
https://community.powerbi.com/t5/Quick-Measures-Gallery/Periodic-Billing/m-p/409365


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
IntaBruce
Helper II
Helper II

Thank you @Greg_Deckler for your super quick response!

I have attempted to replicate your code with my table and field names inserted.  However the result was not quite as expected:

IntaBruce_0-1664482865768.png

I struggled to follow the code so may have got something wrong but I'm pretty sure I don't have 49 open orders for the duration of the year.  Below is a sample of the data showing fulfillment dates in various months.

IntaBruce_1-1664483186989.png

 

This is the measure:

 

Orders Open =
VAR tmpOrders = ADDCOLUMNS('salesorder',"Effective Date",IF(ISBLANK([Date Fulfilled]),TODAY(),[Date Fulfilled]))
VAR tmpTable =  
SELECTCOLUMNS(
    FILTER(
        GENERATE(
            tmpOrders,
            'Calendar'
        ),
        AND(
            [Date] >= [Date Fulfilled] && [Date] <= [Effective Date],
            NOT([Created On]=[Effective Date])
        )
    ),
    "ID",[(pk)Order],
    "Date",[Date]
)
VAR tmpTable1 = GROUPBY(tmpTable,[ID],"Count",COUNTX(CURRENTGROUP(),[Date]))
RETURN COUNTROWS(tmpTable1)
 
Can you see my error?
Greg_Deckler
Super User
Super User

@IntaBruce 
Take a look at these two Quick Measures as I think you want something like them.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Open-Tickets/m-p/409364
https://community.powerbi.com/t5/Quick-Measures-Gallery/Periodic-Billing/m-p/409365


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hi again @Greg_Deckler , I think I have fixed the code.  I needed to specify .[Date] after the field name and now it works (almost!  There is still a problem with open and closed on the same day, but I'm not actually sure if I need to count those)

Final measure and result below, thanks again for your post! 🙂 

IntaBruce_0-1664530653464.png

IntaBruce_1-1664530688680.png

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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