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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Rayzo92
Helper I
Helper I

Create calculated column based on another column result

Hello dear members , 

I have a table called planning that contain the absence details of my employees . 

 

I wanted to create a calculated column that contain the absence details of my employee but in case an employee have 2 absence reasons in the same day  i want the colmumn to have the value Multi .

 

I did some research and i notice that i might be able to do that with all expect funtion , but here i have 2 condition (same ID and same Day)

Here is a small sample ! what im trying to acheive (Created column in green 😞 

 

Rayzo92_0-1671116136865.png

 

thanks in advance all 

 

1 ACCEPTED SOLUTION
serpiva64
Solution Sage
Solution Sage

Hi,

with Dax you can add a calculate column

serpiva64_0-1671119561413.png

Column = var currid = 'Table'[ID]
var currdate = 'Table'[Date]
var result = countrows(FILTER('Table','Table'[ID]=currid && 'Table'[Date]=currdate))
return
if (result=2,"Multi", 'Table'[Reason])
If this post is useful to help you to solve your issue consider giving the post a thumbs up  and accepting it as a solution !

 

 

View solution in original post

7 REPLIES 7
Rayzo92
Helper I
Helper I

Hello , 

 

@Bifinity_75,  @serpiva64  thanks for your answers .

 

your both solution are working but there is only 1 condition that have issue , is that when the employee is absent the same day with the same reason it shouldnt show multi since it's the same reason of absence .

Hi,

try this

Column1 = var currid = 'Table'[ID]
var currdate = 'Table'[Date]
var result = CALCULATE(DISTINCTCOUNT('Table'[Reason]),FILTER('Table','Table'[ID]=currid && 'Table'[Date]=currdate))
return
if (result=2,"Multi", 'Table'[Reason])

@serpiva64  , unfortunately the query dont want to charge . it keep loading only , do you think it's related to the query performance ? 

Hi,

Can you post your calculated column?

M1 = var currid = Planning[Matricule]
var currdate = Planning[Date Planning]
var result = CALCULATE(DISTINCTCOUNT(Planning[Measure planning_theorique] ),FILTER(Planning,Planning[Matricule]=currid && Planning[Date Planning]=currdate))

return

if (result=2,"Multi", Planning[Measure planning_theorique])
 
this is my calculation column dax 
Bifinity_75
Solution Sage
Solution Sage

Hi @Rayzo92 , try this calculate column:

Created Column = IF(
CALCULATE(COUNTROWS('Table'),ALLEXCEPT('Table','Table'[id],'Table'[day]))>1,
"Multiple",'Table'[reason of absence])

 

Best regards

 

serpiva64
Solution Sage
Solution Sage

Hi,

with Dax you can add a calculate column

serpiva64_0-1671119561413.png

Column = var currid = 'Table'[ID]
var currdate = 'Table'[Date]
var result = countrows(FILTER('Table','Table'[ID]=currid && 'Table'[Date]=currdate))
return
if (result=2,"Multi", 'Table'[Reason])
If this post is useful to help you to solve your issue consider giving the post a thumbs up  and accepting it as a solution !

 

 

Helpful resources

Announcements
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.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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