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
icosta7
New Member

MEASURE TO COUNT VARIOUS VALUES FILTERED

Hi there!
I am still crawling in PBI and it may be that my question is very basic,

but as I spent the whole afternoon looking for an answer on the forums and I didn't find anything, I decided to post my question here.

 

The thing is, I have a connection to the SQL Server of the Integrated System of the company I work for (hospital).

 

I am developing a CANCELLATION RATE indicator (KPI).

 

The calculation is as follows:
I need to know
the total number of TREATMENTS PERFORMED
+
the total of CANCELED TREATMENTS

 

A percentage of CANCELED TREATMENTS is the value of my indicator.

 

The goal is for it to stay below 3%.

 

Now for the calculations. In the table that I have my database.

 

* Leave a link with a sample file.

Exemple 

 

I need to COUNT and SUM THE SYSTEM STATUS are equal to " C", "FC", "SC"
The result is the total of TREATMENTS PERFORMED

 

I need to COUNT and SUM THE SYSTEM STATUS are equal to "X", "M", "E"
The result is the total of CANCELED TREATMENTS

 

SYSTEM STATUS = Status do Sistema

Prontuário = ID Number

 

Thanks in advance!

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @icosta7 ,

 

You need to create the following measures:

 

Tratamentos realizados = CALCULATE(COUNTA(data[Status do Sistema]);data[Status do Sistema] in {" C"; "FC"; "SC"})

Tratamentos cancelados = CALCULATE(COUNTA(data[Status do Sistema]);data[Status do Sistema] in {"E"; "M"; "X"})

 

Be aware that in some status you have a space before the code (example C) so I had to do it in the formula as you can see.

 

See attach file.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

2 REPLIES 2
MFelix
Super User
Super User

Hi @icosta7 ,

 

You need to create the following measures:

 

Tratamentos realizados = CALCULATE(COUNTA(data[Status do Sistema]);data[Status do Sistema] in {" C"; "FC"; "SC"})

Tratamentos cancelados = CALCULATE(COUNTA(data[Status do Sistema]);data[Status do Sistema] in {"E"; "M"; "X"})

 

Be aware that in some status you have a space before the code (example C) so I had to do it in the formula as you can see.

 

See attach file.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Valeu amigo! Só fiz alguns pequenos ajustes e acrescentei uma nova medida. Ajudou bastante!

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.