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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
atjt217
Helper III
Helper III

Help with data Modeling for a table with multiple dates

Hello PBI wizards, Please help me out. I have 2 tables that contains the Order details and the User ID:

 

Order details table: 

OrderNumberCreatedDateUserIdAssignedDateAssignedByTextedDateTextsSentByTextSuccess
OR-2101030011/3/2021A00401/3/2021B37221/3/2021B3722TRUE
OR-2101030011/3/2021A00401/3/2021A00401/3/2021A0040FALSE
OR-2101041051/4/2021B37221/4/2021B37221/4/2021C6347FALSE
OR-2101040011/4/2021C63471/4/2021C63471/4/2021B3722TRUE
OR-2101050011/5/2021A00401/5/2021A00401/5/2021A0040FALSE
OR-2101060011/6/2021A00401/6/2021A00401/6/2021A0040TRUE
OR-2101060021/6/2021B37221/6/2021A00401/6/2021B3722TRUE
OR-2101051131/5/2021A00401/5/2021C63471/5/2021A0040TRUE
OR-2101051161/5/2021B37221/5/2021A00401/5/2021C6347TRUE
OR-2101070441/7/2021C63471/7/2021A00401/7/2021A0040FALSE
OR-2101050621/5/2021C63471/5/2021C63471/5/2021B3722FALSE
OR-2101069061/6/2021C63471/6/2021B37221/6/2021A0040TRUE
OR-2101071001/7/2021B37221/7/2021C63471/7/2021C6347TRUE
OR-2101070201/7/2021C63471/7/2021B37221/7/2021B3722FALSE
OR-2101060681/6/2021C63471/6/2021A00401/6/2021C6347TRUE
OR-2101051691/5/2021B37221/6/2021A00401/5/2021A0040TRUE

 

User Id: (Note: on the order details table the User Id is also used on Assignedby and Texted by)

UserIDAgentName
A0040Agent A
B3722Agent B
C6347Agent C

 

What im trying to do is figure out the number the following: 

  • The count of Order created each agent made based of the created date 
  • The count of Order that was assigned based of Assigned date 
  • The count of Order each agent sent a text to based of TextedDate and how many from those were successful 

For example: 

On 1/13/2021 for Created Date, Asigned Date and Texted Date: 

AgentNameCreatedDate AssignedDateTextedDateTextSuccess
Agent A2110
Agent B0111
Agent C0000

 

How do i create a relationship for these 2 tables and what formula should i use to get a count? 

1 ACCEPTED SOLUTION
v-janeyg-msft
Community Support
Community Support

Hi,  @atjt217 

 

The relationship is more complicated. If you just want this result, it is not recommended to establish a relationship.

You can create a date table that you want to query the time period, and create four measures to calculate your desired result.

Like this:

Table = CALENDAR(DATE(2021,1,1),DATE(2021,1,10))
Measure1 =
CALCULATE (
    COUNTROWS ( 'Order' ),
    FILTER (
        ALL ( 'Order' ),
        [CreatedDate] = SELECTEDVALUE ( 'Table'[Date] )
            && [UserId] = SELECTEDVALUE ( User[UserID] )
    )
) + 0

Snipaste_2021-03-18_17-22-53.png

Here is my sample .pbix file.Hope it helps.

If it doesn’t solve your problem, please feel free to ask me.

 

Best Regards

Janey Guo

 

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

View solution in original post

4 REPLIES 4
v-janeyg-msft
Community Support
Community Support

Hi,  @atjt217 

 

The relationship is more complicated. If you just want this result, it is not recommended to establish a relationship.

You can create a date table that you want to query the time period, and create four measures to calculate your desired result.

Like this:

Table = CALENDAR(DATE(2021,1,1),DATE(2021,1,10))
Measure1 =
CALCULATE (
    COUNTROWS ( 'Order' ),
    FILTER (
        ALL ( 'Order' ),
        [CreatedDate] = SELECTEDVALUE ( 'Table'[Date] )
            && [UserId] = SELECTEDVALUE ( User[UserID] )
    )
) + 0

Snipaste_2021-03-18_17-22-53.png

Here is my sample .pbix file.Hope it helps.

If it doesn’t solve your problem, please feel free to ask me.

 

Best Regards

Janey Guo

 

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

Thank you! i think this is the best solution for it. I appreciate your help! 

Ashish_Mathur
Super User
Super User

Hi,

Please explain how you arrived at the results in last table.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi Ashish, 

That is what im trying to achieve i don't have a solution for it i manually counted the last table on excel. I want to know what is possible with Power BI or anything close to that even if they are not on the same table. As long as i can get a count of what each Agent created, assigned and texted. 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.