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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Noredlac86
Helper I
Helper I

Power BI DAX count using multiple and hard conditions

Hi Team.


I was wondering if someone can help me with my doubt.

 

I have a table why employes the month that they work and if they are the employee of the month:

 

For example In januay the employee of the mont was Jhon and Angela.

In March, only Jhon and Angela works and the employee of the month was Jhon.

 

EmployIDwork in the monthemployee of the month
Jhon109JanuaryYes
Angela205JanuaryYes
Rick301JanuaryNo
Jhon109FebraryYes
Angela205FebraryYes
Rick301FebraryYes
Jhon109MarchYes
Angela205MarchNo
Jhon109AprilNo
Angela205AprilYes
Rick301AprilYes

 

However i need to know in each month,How many times has an employee been Employee of the Month consecutively?For example (Please see last two columns):

 

EmployIDwork in the monthemployee of the monthHow many times has an employee been Employee of the Month consecutively?Wich Month?
Jhon109JanuaryYes1 
Angela205JanuaryYes0 
Rick301JanuaryNo0 
Jhon109FebraryYes2Febrary, January
Angela205FebraryYes2Febrary, January
Rick301FebraryYes0 
Jhon109MarchYes3March, Febrary, JAnuary
Angela205MarchNo0 
Jhon109AprilNo0 
Angela205AprilYes0 
Rick301AprilYes2Abril, Febrary

 

The idea is review per month and check if the last month the employee was "Employee of the month" 

In the example: In April, Jhon was not employee of the month, therefore we dont need to compare with the last months, Angela it was, but the month after april(March) was not employ of the month, theforefore its 0. 

Rick it was employee of the month in April, in march does not work (we only compare with the months that he work) until febrary that hi also was employee of the months, that means two consecutive months.

I know that his hard, but not sure if its possible to do it in powerbi?

Thanks!

 

pd: Sorry for my english is no my first language

4 REPLIES 4
Kishore_Kadhir
Resolver II
Resolver II

Hi @Noredlac86 ,

 

1. Create a calculated column with the below DAX.

Index = IF(Another[Month]="Jan", 1, IF(Another[Month]="Feb", 2))

Kishore_Kadhir_1-1657330334324.png

2) Create another calculated column with the below DAX.

Which Month = IF('Another Table'[employee of month] = "Yes", CALCULATE(CONCATENATEX(VALUES('Another Table'[Month]), 'Another Table'[Month], ", "), FILTER(ALL('Another Table'), 'Another Table'[employee of month]="Yes" && 'Another Table'[Index] <= EARLIER('Another Table'[Index]))), BLANK())

Kishore_Kadhir_0-1657335448532.png

Kishore_Kadhir_1-1657335491134.png

Hope this solves your issue.

 

Regards,

Kishore

HI.
Thanks for your time, one question how do you create "how many times" column?

Hi @Noredlac86 ,

 

See the DAX below:

How Many Times = CALCULATE(COUNTROWS('Another Table'), FILTER(ALLEXCEPT('Another Table', 'Another Table'[EmployeeID]), 'Another Table'[employee of month]="Yes" && 'Another Table'[Index] <= EARLIER('Another Table'[Index])))
Kishore_Kadhir_0-1657599198032.png

 

Hi @Kishore_Kadhir 

Thanks for your help. I have created more records using this file

 

And i include the fomula tor how many times: 

How Many Times = CALCULATE(COUNTROWS('Another Table'), FILTER(ALLEXCEPT('Another Table', 'Another Table'[EmployeeID]), 'Another table'[Employee of the month]="Yes" && 'Another Table'[Index] <= EARLIER('Another Table'[Index])))


However in the results does not show correct, 
For example if i check July for Rick, should:
July(Yes) + Jun(Yes) + May(Yes) + April(Yes)+ Mar(Yes)+Feb(No) STOP =5
For example July Angela:

July (Yes) + June(No) STOP =1

 

The review will be only for consecutive months.

Captura de pantalla 2022-07-12 155841.png

I was wondering if you can help me with this. im trying a lot of think, but im not an expert with this.

Thanks so much for your time.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.