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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
frankhofmans
Helper IV
Helper IV

How to present frequent cases

Hi PBI experts,

 

I have the following problem:

 

i have a database with sick employees and the sickness date. I want to present the number of sickness cases if:

 

- a employee is sick 3 times or more in the 6 months before the last sickness date

- a empoloyee is sick 4 times or more in the 12 months before the last sickness date

 

This is an example of my database:

 

Employee IDSickness date
11001-12-2019
12301-12-2020
13503-01-2020
14707-01-2020
17820-02-2020
15910-01-2020
20001-03-2020
20105-03-2020
26710-03-2020
12310-04-2020
15910-05-2020
17812-05-2020
11013-05-2020
11020-05-2020
15901-06-2020
12303-06-2020
20001-07-2020
20003-08-2020
17810-08-2020
17801-09-2020

 

I want 1 graph and 1 table:

 

Graph:

Month/Year01-202002-202003-202004-202005-202006-202007-202008-202009-2020
# of frequent cases00002 (2x empl. ID 110)2 (empl ID 159 and empl ID 123)2 (2x empl. ID 200)1 (empl ID 178)1 (emp ID 178)

 

Table (for example selected periode 06-2020)

 

Employee IDLast sickness date# of cases in 6 months before latest sickness date# of cases in 12 months before latest sickness date
12303-06-202033
15901-06-202033

 

Can someone help me out with this question?

 

Thanks in advance!

 

Regards, Frank

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @frankhofmans ,

 

Based on your description, you can create some measures as follows.

Thanks for @amitchandak 's advise.

 

Test table:

v-yuaj-msft_0-1608182833266.png

 

rolling 12 months = CALCULATE(COUNT('Table'[Sickness date]),DATESINPERIOD('Table'[Sickness date],MAX('Table'[Sickness date]),-12,MONTH))




rolling 6 months = CALCULATE(COUNT('Table'[Sickness date]),DATESINPERIOD('Table'[Sickness date],MAX('Table'[Sickness date]),-6,MONTH))




Measure 2 =

var x1=IF(CALCULATE(COUNT('Table'[Sickness date]),DATESINPERIOD('Table'[Sickness date],MAX('Table'[Sickness date]),-12,MONTH))>=4,1)

var x2=IF(CALCULATE(COUNT('Table'[Sickness date]),DATESINPERIOD('Table'[Sickness date],MAX('Table'[Sickness date]),-6,MONTH))>=3,1)

return

x1+x2

 

Result:

  • Graph:

v-yuaj-msft_1-1608182833272.png

 

  • Table:

v-yuaj-msft_2-1608182833274.png

 

Hope that's what you were looking for.

Best Regards,

Yuna

 

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

3 REPLIES 3
Anonymous
Not applicable

Hi @frankhofmans ,

 

Based on your description, you can create some measures as follows.

Thanks for @amitchandak 's advise.

 

Test table:

v-yuaj-msft_0-1608182833266.png

 

rolling 12 months = CALCULATE(COUNT('Table'[Sickness date]),DATESINPERIOD('Table'[Sickness date],MAX('Table'[Sickness date]),-12,MONTH))




rolling 6 months = CALCULATE(COUNT('Table'[Sickness date]),DATESINPERIOD('Table'[Sickness date],MAX('Table'[Sickness date]),-6,MONTH))




Measure 2 =

var x1=IF(CALCULATE(COUNT('Table'[Sickness date]),DATESINPERIOD('Table'[Sickness date],MAX('Table'[Sickness date]),-12,MONTH))>=4,1)

var x2=IF(CALCULATE(COUNT('Table'[Sickness date]),DATESINPERIOD('Table'[Sickness date],MAX('Table'[Sickness date]),-6,MONTH))>=3,1)

return

x1+x2

 

Result:

  • Graph:

v-yuaj-msft_1-1608182833272.png

 

  • Table:

v-yuaj-msft_2-1608182833274.png

 

Hope that's what you were looking for.

Best Regards,

Yuna

 

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

amitchandak
Super User
Super User

@frankhofmans , Try with help from date table

 

Rolling 6 = CALCULATE(sum(Table[Sickness date]),DATESINPERIOD('Date'[Date ],MAX(Table[Sickness Date]),-6,MONTH))

 

Rolling 12 = CALCULATE(sum(Table[Sickness date]),DATESINPERIOD('Date'[Date ],MAX(Table[Sickness Date]),-12,MONTH))

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Hi Amitchandak,

 

If i generate your measure or calculated colums, i get only results with value 1. Do you have an example for me? 

 

Thanks in advance,

 

Regards, Frank

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.