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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Hamdan1234
Helper III
Helper III

DAX Formula

I had this below table. 

CourseABC1ABC2ABC3
Duration36 Months24 Months18 Months
Asst ManagerYNY
ADYNY
CEONYN
COONNY
ManagerYYN

to which after transposing I converted to below

Job PostCoursesDurationCompletion
Asst ManagerABC136 MonthsY
ADABC136 MonthsY
CEOABC136 MonthsN
COOABC136 MonthsN
ManagerABC136 MonthsY
Asst ManagerABC224 MonthsN
ADABC224 MonthsN
CEOABC224 MonthsY
COOABC224 MonthsN
ManagerABC224 MonthsY
Asst ManagerABC318 MonthsY
ADABC318 MonthsY
CEOABC318 MonthsN
COOABC318 MonthsY
ManagerABC318 MonthsN

I then merged it with another table my table loooks like this now

Job PostCoursesDurationCompletionCompletion Date
Asst ManagerABC136 MonthsY12/02/2015
ADABC136 MonthsY18/02/2018
CEOABC136 MonthsN17/08/2020
COOABC136 MonthsN09/10/2012
ManagerABC136 MonthsY12/02/2017
Asst ManagerABC224 MonthsN08/02/2019
ADABC224 MonthsN01/08/2020
CEOABC224 MonthsY09/01/2012
COOABC224 MonthsN12/02/2021
ManagerABC224 MonthsY02/02/2015
Asst ManagerABC318 MonthsY01/02/2018
ADABC318 MonthsY07/08/2020
CEOABC318 MonthsN09/10/2017
COOABC318 MonthsY12/02/2017
ManagerABC318 MonthsN08/02/2019

The data shows that each post has completed the courses and have dates with them showing when they completed. The duration of test shows how long will it be valid. So I want to have two columns or measures. One will show the date with respect to duration and date the compliance of each job. My outcome should look like below table.

Job PostCoursesDurationCompletionCompletion DateValid Date of TestTest take
Asst ManagerABC136 MonthsY12/02/201512/02/2018Non compliant
ADABC136 MonthsY18/02/201818/02/2021Non compliant
CEOABC136 MonthsN17/08/202017/08/2023Compliant
COOABC136 MonthsN09/10/201209/10/2015Non compliant
ManagerABC136 MonthsY12/02/201712/02/2020Non compliant
Asst ManagerABC224 MonthsN08/02/201908/02/2021Non compliant
ADABC224 MonthsN01/08/202001/08/2022Compliant
CEOABC224 MonthsY09/01/201209/01/2014Non compliant
COOABC224 MonthsN12/02/202112/02/2023Compliant
ManagerABC224 MonthsY02/02/201502/02/2017Non compliant
Asst ManagerABC318 MonthsY01/02/201801/02/2020Non compliant
ADABC318 MonthsY07/08/202007/08/2022Compliant
CEOABC318 MonthsN09/10/201709/10/2019Non compliant
COOABC318 MonthsY12/02/201712/02/2019Non compliant
ManagerABC318 MonthsN08/02/201908/02/2021Non compliant
1 ACCEPTED SOLUTION
smpa01
Super User
Super User

@Hamdan1234  you can use following two measures to achieve what you need after the very final merge

 

ValidUntil = 
VAR _0 = ADDCOLUMNS('Table',"ValidTill", 'Table'[Completion Date]+(CONVERT(LEFT('Table'[Duration],2),INTEGER)*DIVIDE(365,12)))
RETURN MAXX(_0,[ValidTill])

isValidNow = SWITCH(true(),[ValidUntil]<=TODAY(),"Non COmpliant","Compliant")

 

smpa01_0-1634153623397.png

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

View solution in original post

1 REPLY 1
smpa01
Super User
Super User

@Hamdan1234  you can use following two measures to achieve what you need after the very final merge

 

ValidUntil = 
VAR _0 = ADDCOLUMNS('Table',"ValidTill", 'Table'[Completion Date]+(CONVERT(LEFT('Table'[Duration],2),INTEGER)*DIVIDE(365,12)))
RETURN MAXX(_0,[ValidTill])

isValidNow = SWITCH(true(),[ValidUntil]<=TODAY(),"Non COmpliant","Compliant")

 

smpa01_0-1634153623397.png

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.