cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
addicted87
Helper I
Helper I

Count cases for a period, which may completed even in another period

hi to all of you,

 

yet I have another issue with creating a measure, which counts the completed number of cases per supplier. So far it is not a problem. BUT... it is possible, that the case will be completed on a following quarter, compared to the selected one.

 

example for one supplier:

 

suppliercaseidquarter of orderquarter of completion
11011
11112
11222
11334

 

So if I select

 

quarter = 1, I expect the measure value = 1

quarter = 2, I expect the measure value = 2

quarter = 3, I expect the measure value = 0

quarter = 4, I expect thr measure value = 1

 

Alright, there is always one quarter selected, so I could use the quarter of completion for a result table. But I need the number of cases, bases on quarter of order as well in the result table and I can only filter the quarter either on order quarter or completion quarter.

 

the result table for quarter 1 should looks like this:

 

supplier# of cases# of completed cases
121
2nm
.........

 

Hope someone can help me;-)

THX

1 ACCEPTED SOLUTION

@addicted87 have you looked at the link I posted? Do you have a DimDate table? https://excelwithallison.blogspot.com/2020/04/dimdate-what-why-and-how.html
You will need one for this, with active relationship to OrderDate and Inactive relationship to CompletedDate

then put DimDate[Quarter] in the slicer and create 2 measures for [Orders] = Count(Sales[CaseID])
and [Completed Orders] = CALCULATE(Count(Sales[CaseID]), USERELATIONSHIP(Sales[CompletedDate], DimDate[Date])

Please @mention me in your reply if you want a response.

Check out my Tokyo 2020 report with live stats - KUDOS much appreciated

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@addicted87 , I did not get the logic , you are using

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin

Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
Proud to be a Super User!

hey @amitchandak ,

 

lets say we have an entry for supplier 1:

 

supplier 1 | caseid | order quarter | completion quarter |

1 | ABC | 1 | 3

1 | ABD | 3 | 4

If the user selects quarter 3 (based on order date) and looks at the result table, he will get this list:

 

Supplier | # of new orders | # of completed orders

1 | 1 | 0 --> but this is not correct. Indeed, there is just one new order in Q3 (ABD) --> correct, but there is also a completed order (ABC) in Q3, so I'd like to display a 1 in column [# of completed orders] (measure).

 

The problem is, that the order quarters and completion quarters aren't always the same per record, so if I filter one date (order vs. complete) the data will also get filtered and records will be lost in calculation.

 

I hope, this one is more understandable than in my first post.

 

Thx

 

 

@addicted87 have you looked at the link I posted? Do you have a DimDate table? https://excelwithallison.blogspot.com/2020/04/dimdate-what-why-and-how.html
You will need one for this, with active relationship to OrderDate and Inactive relationship to CompletedDate

then put DimDate[Quarter] in the slicer and create 2 measures for [Orders] = Count(Sales[CaseID])
and [Completed Orders] = CALCULATE(Count(Sales[CaseID]), USERELATIONSHIP(Sales[CompletedDate], DimDate[Date])

Please @mention me in your reply if you want a response.

Check out my Tokyo 2020 report with live stats - KUDOS much appreciated

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

View solution in original post

AllisonKennedy
Super User
Super User

Have you tried the USERELATIONSHIP function for this? https://blog.enterprisedna.co/working-with-multiple-dates-in-power-bi/

Please @mention me in your reply if you want a response.

Check out my Tokyo 2020 report with live stats - KUDOS much appreciated

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

November Power BI Update 768x460.png

Check it Out!

Click here to read more about the November 2021 Updates!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.