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
CarloA93
Frequent Visitor

How do I show monthly compliance?

I have a dataset of patient weights, and they want me to be able to show whether or not a weight for a patient was taken at least once a month. They want it to be expressed as a percentage for each Quarter, both individually and for a group home. (example: for Q1, patient A had a weight recording for 2 of the 3 months, or 66% compliance.)

 

The problems I am running into are:

1) How do I show whether or not a recording was taken for each month, and then going along with this:

2) If a patient is new, then not having any recordings wouldn’t be differentiated from not having a recording, for example, if they moved into the group home in the middle of the quarter.

3) Some patients have multiple recording in a single month, but I really only need to show whether or not a recording was taken.

I can show how many for a month in a different visual, and I can approximate a percentage based on counts per expected value, but it doesn’t take into account multiple recordings.

 

Patient Name

Date

Weight

Group Home

Case Manager

DOE, JOHN

15-Sep

195

Wheatland

Arnold Jones

DOE, JOHN

15-Aug

195.8

Wheatland

Arnold Jones

CHAN, LESLIE

15-Sep

180.6

Wheatland

Arnold Jones

CHAN, LESLIE

15-Aug

181

Wheatland

Arnold Jones

ROCKS, CALLUM

15-Sep

160.8

Wheatland

Arnold Jones

ROCKS, CALLUM

15-Aug

161

Wheatland

Arnold Jones

ROCKS, CALLUM

17-Jul

163

Wheatland

Arnold Jones

 

 

 

2 ACCEPTED SOLUTIONS
lbendlin
Super User
Super User

Here is one possible implementation.  

 

lbendlin_0-1664065428205.png

 

View solution in original post

v-yadongf-msft
Community Support
Community Support

Hi @CarloA93 ,

 

This is my test table:

vyadongfmsft_0-1664343318830.png

 

Please try following DAX to create new columns:

 

MonthNumber = MONTH('Table'[Date])

Jul 22 = 
var CountJuly = COUNTX(FILTER('Table','Table'[Patient Name] = EARLIER('Table'[Patient Name]) && 'Table'[MonthNumber] = 7), 'Table'[MonthNumber])
return
IF( CountJuly >=1,"Yes","No")

Aug 22 = 
var CountAug = COUNTX(FILTER('Table','Table'[Patient Name] = EARLIER('Table'[Patient Name]) && 'Table'[MonthNumber] = 8), 'Table'[MonthNumber])
return
IF( CountAug >=1,"Yes","No")

Sep 22 = 
var CountSep = COUNTX(FILTER('Table','Table'[Patient Name] = EARLIER('Table'[Patient Name]) && 'Table'[MonthNumber] = 7), 'Table'[MonthNumber])
return
IF( CountSep >=1,"Yes","No")

Percent Compliance (Quarter) = 
var Count_Jul22 = COUNTX(FILTER('Table','Table'[Patient Name] = EARLIER('Table'[Patient Name]) ), 'Table'[Jul 22])
var Count_Aug22 = COUNTX(FILTER('Table','Table'[Patient Name] = EARLIER('Table'[Patient Name]) ), 'Table'[Aug 22])
var Count_Sep22 = COUNTX(FILTER('Table','Table'[Patient Name] = EARLIER('Table'[Patient Name]) ), 'Table'[Sep 22])
var CountYes_Jul22 = COUNTX(FILTER('Table','Table'[Patient Name] = EARLIER('Table'[Patient Name]) && 'Table'[Jul 22] = "Yes"), 'Table'[Jul 22])
var CountYes_Aug22 = COUNTX(FILTER('Table','Table'[Patient Name] = EARLIER('Table'[Patient Name]) && 'Table'[Aug 22] = "Yes"), 'Table'[Aug 22])
var CountYes_Sep22 = COUNTX(FILTER('Table','Table'[Patient Name] = EARLIER('Table'[Patient Name]) && 'Table'[Sep 22] = "Yes"), 'Table'[Sep 22])
return
DIVIDE(CountYes_Jul22 + CountYes_Aug22 + CountYes_Sep22, Count_Jul22 + Count_Aug22 + Count_Sep22)

Percent Compliance (Quarter)/House = IF('Table'[Date] = MAXX(FILTER('Table','Table'[Patient Name] = EARLIER('Table'[Patient Name])),'Table'[Date]),'Table'[Percent Compliance (Quarter)])

 

vyadongfmsft_1-1664343439683.png

 

The result you want:

vyadongfmsft_2-1664343464359.png

Best regards,

Yadong Fang

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

7 REPLIES 7
v-yadongf-msft
Community Support
Community Support

Hi @CarloA93 ,

 

This is my test table:

vyadongfmsft_0-1664343318830.png

 

Please try following DAX to create new columns:

 

MonthNumber = MONTH('Table'[Date])

Jul 22 = 
var CountJuly = COUNTX(FILTER('Table','Table'[Patient Name] = EARLIER('Table'[Patient Name]) && 'Table'[MonthNumber] = 7), 'Table'[MonthNumber])
return
IF( CountJuly >=1,"Yes","No")

Aug 22 = 
var CountAug = COUNTX(FILTER('Table','Table'[Patient Name] = EARLIER('Table'[Patient Name]) && 'Table'[MonthNumber] = 8), 'Table'[MonthNumber])
return
IF( CountAug >=1,"Yes","No")

Sep 22 = 
var CountSep = COUNTX(FILTER('Table','Table'[Patient Name] = EARLIER('Table'[Patient Name]) && 'Table'[MonthNumber] = 7), 'Table'[MonthNumber])
return
IF( CountSep >=1,"Yes","No")

Percent Compliance (Quarter) = 
var Count_Jul22 = COUNTX(FILTER('Table','Table'[Patient Name] = EARLIER('Table'[Patient Name]) ), 'Table'[Jul 22])
var Count_Aug22 = COUNTX(FILTER('Table','Table'[Patient Name] = EARLIER('Table'[Patient Name]) ), 'Table'[Aug 22])
var Count_Sep22 = COUNTX(FILTER('Table','Table'[Patient Name] = EARLIER('Table'[Patient Name]) ), 'Table'[Sep 22])
var CountYes_Jul22 = COUNTX(FILTER('Table','Table'[Patient Name] = EARLIER('Table'[Patient Name]) && 'Table'[Jul 22] = "Yes"), 'Table'[Jul 22])
var CountYes_Aug22 = COUNTX(FILTER('Table','Table'[Patient Name] = EARLIER('Table'[Patient Name]) && 'Table'[Aug 22] = "Yes"), 'Table'[Aug 22])
var CountYes_Sep22 = COUNTX(FILTER('Table','Table'[Patient Name] = EARLIER('Table'[Patient Name]) && 'Table'[Sep 22] = "Yes"), 'Table'[Sep 22])
return
DIVIDE(CountYes_Jul22 + CountYes_Aug22 + CountYes_Sep22, Count_Jul22 + Count_Aug22 + Count_Sep22)

Percent Compliance (Quarter)/House = IF('Table'[Date] = MAXX(FILTER('Table','Table'[Patient Name] = EARLIER('Table'[Patient Name])),'Table'[Date]),'Table'[Percent Compliance (Quarter)])

 

vyadongfmsft_1-1664343439683.png

 

The result you want:

vyadongfmsft_2-1664343464359.png

Best regards,

Yadong Fang

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

v-yadongf-msft
Community Support
Community Support

Hi @CarloA93 ,

 

Has your problem been solved? If solved, please consider Accept it as the solution to help the other members find it more quickly.

 

Best regards,

Yadong Fang

 

Ashish_Mathur
Super User
Super User

Hi,

Share a larger dataset and show the expected result.


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

Here's a slightly larger dataset:

 

Patient NameDateWeightHouseManager
LARSON, STEVEN 9/15/2022195WheatlandEmily Troxell
LARSON, STEVEN 8/15/2022195.8WheatlandEmily Troxell
KEITH, KEVIN 9/15/2022180.6WheatlandEmily Troxell
KEITH, KEVIN 8/15/2022181WheatlandEmily Troxell
TRUMAN, FAITH 9/15/2022160.8WheatlandEmily Troxell
TRUMAN, FAITH 8/15/2022161WheatlandEmily Troxell
TRUMAN, FAITH 7/17/2022163WheatlandEmily Troxell
CHOW, MARIE 4/15/2022227WheatlandEmily Troxell
CHOW, MARIE 9/15/2022230.4WheatlandEmily Troxell
CHOW, MARIE 8/15/2022231.8WheatlandEmily Troxell
CHOW, MARIE 7/15/2022234.2WheatlandEmily Troxell
CHOW, MARIE 5/15/2022236.2WheatlandEmily Troxell
CHOW, MARIE 6/15/2022236.4WheatlandEmily Troxell
MCMURRAY, JANE 8/15/2022161.6WheatlandEmily Troxell
MCMURRAY, JANE 7/15/2022163WheatlandEmily Troxell
MCMURRAY, JANE 5/15/2022164.8WheatlandEmily Troxell
MCMURRAY, JANE 6/15/2022165.2WheatlandEmily Troxell
MCMURRAY, JANE 9/15/2022166.4WheatlandEmily Troxell
DOE, JOHN 7/12/2022213.4WheatlandEmily Troxell
DOE, JOHN 7/19/2022214WheatlandEmily Troxell
DOE, JOHN 8/2/2022214.6WheatlandEmily Troxell
DOE, JOHN 7/26/2022215.8WheatlandEmily Troxell
DOE, JOHN 8/16/2022216.4WheatlandEmily Troxell
DOE, JOHN 9/6/2022216.4WheatlandEmily Troxell
DOE, JOHN 8/30/2022217WheatlandEmily Troxell
DOE, JOHN 8/9/2022217.2WheatlandEmily Troxell
DOE, JOHN 8/23/2022217.8WheatlandEmily Troxell
DOE, JOHN 9/13/2022220.2WheatlandEmily Troxell

 

I would essentially want to show whether or not there was a recording each month, and then be able to calculate the percentage of the time a recording was taken to meet the minimum requirement that each individual as well as each household.

 

For example:

 

 

 

Jan 22

Feb 22

Mar 22

Percent Compliance (Quarter)

PersonA (House A)

Yes (if there is at least 1 recording for the month)

Yes

No

66%

PersonB (House A)

No

No

Yes

33%

PersonC (House B)

No

No

No

0%

PersonD (House B)

Yes

No

No

33%

 

 

Percent Compliance

House A

50% (i.e. 3 out of 6 expected recordings)

House B

16.7%

 

 

 

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


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

Here is one possible implementation.  

 

lbendlin_0-1664065428205.png

 

This looks like a step in the right direction. I'll play around with the pbix you attached and see what I can do with my dataset.

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.