Forum Discussion

jj14x's avatar
jj14x
Advocate II
9 years ago
Solved

Build summary visualization showing orders completed/issued in given week

Hi,

    I'm relatively new to Power BI, so I'm hoping there is an easy solution to this request.

I have a set of 5 similar tables - each table is for a specific product, and will have at least the following columns

  • Order Request Received Date (this is the date we recieved the request from client)
  • Order#
  • Order Create Date (the date when the order was created based on request from client)
  • Current Order Status (In Progress/Completed/Canceled)
  • Order Completed Date (the date when order was completed)

(there are other columns too, but some of those will vary between the 5 tables)

 

I need to build a summary visualization (preferably a single one that has data for all 5 tables, but if not, we can live with 5 separate visualizations), that shows the following

  • Week Ending date 
  • Number of requests received (In table, look for records that have "Order Request Received Date" for that week ending)
  • Number of orders issued (In table, look for records that have "Order Create Date" for that week ending)
  • Number of orders completed  (In table, look for records that have "Order Completed Date" for that week ending)
  • Number of orders in progress  (In table, look for records that have ("Order Create Date" <= "Week Ending Date", and "Order Completed Date" >="Week Ending Date" minus 7 calendar days) <-- this logic may need to be tweaked, but it can be done.

 

The question:

 

If I needed to get the count of orders issued, I can just create a matrix visualation that would count number of records by the week/ending of order create date. But given that I want the same visualization to show the count of orders completed in that week, how do I go about creating that (since the count of number of records now has to look at week/ending for order completion date)?

 

 

 

 

  • Personally I would add a custom column to each table in the query editor with the name of the product, then append all tables into one.  Any columns that don't exist across tables will have "null" values or blank for the tables where that column didn't exist.  Then, I would also create a date table that spans the earliest and latest date from this master table. 

     

    After you create relationships between the date table and fact table (you will have one active and two passive relationships), you will need to create some measures depending on the relationship.  With the active relationship, you could simply drag the relevant field to the visual and aggregate as a count, but for the inactive relationships you will need to create a measure using the USERELATIONSHIP function as an argument.

     

    Learn more about date table:

    https://community.powerbi.com/t5/Desktop/Date-Dimension-Table-that-Dynamically-Pulls-Start-and-End-dates/td-p/76870

     

    Learn more about USERELATIONSHIP:

    https://www.sqlbi.com/articles/userelationship-in-calculated-columns/

2 Replies

  • dkay84_PowerBI's avatar
    dkay84_PowerBI
    Microsoft Employee

    Personally I would add a custom column to each table in the query editor with the name of the product, then append all tables into one.  Any columns that don't exist across tables will have "null" values or blank for the tables where that column didn't exist.  Then, I would also create a date table that spans the earliest and latest date from this master table. 

     

    After you create relationships between the date table and fact table (you will have one active and two passive relationships), you will need to create some measures depending on the relationship.  With the active relationship, you could simply drag the relevant field to the visual and aggregate as a count, but for the inactive relationships you will need to create a measure using the USERELATIONSHIP function as an argument.

     

    Learn more about date table:

    https://community.powerbi.com/t5/Desktop/Date-Dimension-Table-that-Dynamically-Pulls-Start-and-End-dates/td-p/76870

     

    Learn more about USERELATIONSHIP:

    https://www.sqlbi.com/articles/userelationship-in-calculated-columns/

    • jj14x's avatar
      jj14x
      Advocate II

      Thank you! That sounds feasible - I'll try that out.