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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
mihaita_baro
Helper II
Helper II

Calculated KPI based on two other columns

Hi guys,

 

I have a small issue with my KPI6 calculation formula, i don't seems to find a calculation for my KPI6

 

Clients must have at least 2 reviews meeting the following criteria:
Session Type is one of the following: Treatment; Assessment and Treatment; Review and Treatment;
And
Attendance Status is one of the following: On time/ahead of staff; Late, was seen; or Blank 

 

And 

Clients must score revgad7anxiety_Result_raw>7 or revphq9depression_Result_raw>9 at Initial Review and
score revgad7anxiety_Result_raw<8 and revphq9depression_Result_raw<10 at Final Review (last review being the latest one with PHQ and GAD assessment); 

 

I have created another  two columns to see if initial review and last review qualify for KPI6 based on revgad7anxiety_Result_raw and revphq9depression_Result_raw and the sessions .

 

All i need now is to calculate KPI6 based on these two columns but i don't seems to find a way.

 

The output is the column "KPI6"

 

kpi6.JPG

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @mihaita_baro ,

Please try below steps:

1. below is my test table

Table:

vbinbinyumsft_0-1662619026465.png

2. add a new column with below dax formula

 

Column =
VAR cur_clientID = 'Table'[Client ID]
VAR tmp =
    FILTER ( ALL ( 'Table' ), 'Table'[Client ID] = cur_clientID )
VAR _a =
    SUMX ( tmp, [KPI6 Initial Review] + [KPI6 Last Review] )
RETURN
    IF (
        _a = 2
            && 'Table'[KPI6 Initial Review] = BLANK ()
            && 'Table'[KPI6 Last Review] = 1,
        1,
        BLANK ()
    )

 

vbinbinyumsft_0-1662619376863.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_ Binbin Yu
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
Anonymous
Not applicable

Hi @mihaita_baro ,

Please try below steps:

1. below is my test table

Table:

vbinbinyumsft_0-1662619026465.png

2. add a new column with below dax formula

 

Column =
VAR cur_clientID = 'Table'[Client ID]
VAR tmp =
    FILTER ( ALL ( 'Table' ), 'Table'[Client ID] = cur_clientID )
VAR _a =
    SUMX ( tmp, [KPI6 Initial Review] + [KPI6 Last Review] )
RETURN
    IF (
        _a = 2
            && 'Table'[KPI6 Initial Review] = BLANK ()
            && 'Table'[KPI6 Last Review] = 1,
        1,
        BLANK ()
    )

 

vbinbinyumsft_0-1662619376863.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_ Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

claymcooper
Resolver II
Resolver II

Try this: Calculate(Count(clientid),KPI6=1)

Hi @claymcooper 

 

That column is the  desired output i wanna calculate.

 

It can be either a calculated column or a measure that count how many clients have KPI6 Initial Review =1 and KPI6 Last review =1

 

This is what i came up with but doesn't calculate properly

 

KPI6 FTB =
CALCULATE(DISTINCTCOUNT(Appointment_FTB[clientId]),
KEEPFILTERS(
FILTER(ALL(Appointment_FTB[KPI6 Initial Review],Appointment_FTB[KPI6 Last Review]),
Appointment_FTB[KPI6 Initial Review]=1 || Appointment_FTB[KPI6 Last Review]=1
)
)
)
claymcooper
Resolver II
Resolver II

Can you enlarge the image or provide a sample pbix? I can't read the screenshot provided.

Hi @claymcooper 

 

I've added it again to original post

Thanks. So from your example are you trying to evaluate how many clients meet the requirements for KPI6? In your screenshot the total would equal 4. Correct?

Hi @claymcooper 

 

Yes that's correct. 4 clients eligible for KPI6. I have tried some thing but i am missing something

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!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.