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
MarkShu
Helper I
Helper I

How to count all clients beyond/without two last months?

I have found:

all clients - CALCULATE(COUNTA('Outflow'[ID]);ALLSELECTED('Outflow'[LastActiveDate])) 

previous month clients - CALCULATE(COUNTA('Outflow'[ID]);PREVIOUSMONTH(DATESMTD('Outflow'[LastActiveDate])))

current month clients - CALCULATE(COUNTA('Outflow'[ID]);DATESMTD('Outflow'[LastActiveDate]))

 

But I don't know how to count all clients beyond/without two last months?

1 ACCEPTED SOLUTION
MarkShu
Helper I
Helper I

Eventually I did this with DAX: Clients = CALCULATE(COUNTA('Outflow'[ID]);FILTER('Outflow;'Outflow'[Date]<DATE(YEAR(today());MONTH(today())-1;1)))

View solution in original post

5 REPLIES 5
MarkShu
Helper I
Helper I

Eventually I did this with DAX: Clients = CALCULATE(COUNTA('Outflow'[ID]);FILTER('Outflow;'Outflow'[Date]<DATE(YEAR(today());MONTH(today())-1;1)))

Thejeswar
Resident Rockstar
Resident Rockstar

@MarkShu,

Try the below DAX formula

 

Clients = CALCULATE(COUNTA('Outflow'[ID]);YEAR('Outflow'[LastActiveDate]) <= YEAR(TODAY()) && MONTH('Outflow'[LastActiveDate]) <= MONTH(TODAY())-2)

Oh! It works only for this year, previous year has shown until April (in matrix) =(((

@MarkShu,

Try this one....

 

Concatenate Year and Month No. and this referes to Year(Last Active Date) and Month(LastActiveDate) respectively

 

ie. YearMonth = 

2018 - Apr looks like  201804

2018 - Mar looks like 201803

2018 - Feb looks like 201802

.

.

.

.

2017 - Jan as 201701

2016 - Dec as 201612

2016 - Nov as 201611

 

Now modify the earlier DAX based on this column

 

Clients = CALCULATE(COUNTA('Outflow'[ID]);YEARMONTH <= MAX(YEARMONTH) - 2)

where YEARMONTH is the newly calculated column

 

Hope this solves this issue!!!

I did this: 

ClientsUntil2LM = CALCULATE(COUNTA('Outflow'[ID]);YEAR('Outflow'[LastActiveDate]) = YEAR(TODAY()) && MONTH('Outflow'[LastActiveDate]) <= MONTH(TODAY())-2)

 

LYsclients = CALCULATE(COUNTA('Outflow'[ID]);YEAR('Отток - всего'Outflow'[LastActiveDate])<>YEAR(TODAY()) )

 

Clients = [ClientsUntil2LM] + [LYsclients]

 

Thank you for your help! 

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.