Forum Discussion

Sparkizone's avatar
Sparkizone
Frequent Visitor
4 years ago
Solved

Count the value based on condition

Hi Everyone,

 

I've tried to count the number of 'Providers' by Measure conditions but no luck last few days. 

Can you please share your ideas?

 

 

So, a column and measures are like

 

Table name: Table 1

Column1 : Providers

Column2: Service Start Date

 

Providers

Service Start Date

A

22/03/2022

B

14/03/2022

C

----

C

----

----

----

 

Table name: Table 2 

Column1: Providers

Column2: Total Contracted Services

 

Providers

Total Contracted Services

A

16

B

50

C

98

D

5

---

---

 

Measures:

Target monthly = 

DIVIDE( 'Table2' [Total Contracted Services],12 )

 

CurrentFYMonth =

IF ( MONTH( TODAY() ) < 7, MONTH ( TODAY () ) + 6, MONTH ( TODAY () ) - 6 )

 

Target Services =

[Target monthly] * ([CurrentFYMonth])

 

Tracking A =  COUNTA('Table1'[Service Start Date]) - [Target Services]

Tracking B =  (Measure) -> Tracking A >= 0

 

 

I can make a table in Power BI as below in visualisation,

 

ProvidersTracking ATracking B
A7True
B12True
C-3False
D56True
E-44False
F0True
---------

 

I want to count the number of providers with True and False separately.

Like 46 providers on Track(True), 15 providers are below ----

 

Thanks,

 

 

 

 

 

6 Replies

  • Sparkizonebasically you are looking for dynamic segmentation, check this post and tweak it as you see fit Dynamic segmentation – DAX Patterns

     

     

    Follow us on LinkedIn and  to our YouTube channel

    I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

     

    Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.

     

  • Hi,

    Define the question in simple English, share some data and show the expected result.