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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anony_mous
Frequent Visitor

Issue in writing DAX measure

Can you please help me to write dynamic DAX measure? I have the date and training validity column in a table. If the date is within that 2 years or 3 years training validity it should show the training status as "completed" if it exceeds 2 years or 3 years it should show the training status as "not completed" I want to know what is the count of training status "completed" and "not completed" during a given period and categorize them meanwhile I have to use TODAY() function in that measure I am using a date in a slicer and by changing the date, I can change the training validity in that given period. 

Thank you so much for any given any help!

 

 

Date          Training Validity       Training Status 

10-Jan-20         2

20-Jan-20         3

21-Jul-20          3

21-Mar-20        2

22-Mar-21.       3

2-Apr-21          3

3-Apr-21          2

2 REPLIES 2
v-jianboli-msft
Community Support
Community Support

Hi @Anony_mous ,

 

Approve with @Greg_Deckler , You can calculate the training status by using these DAX.

However, You said "I am using a date in a slicer and by changing the date, I can change the training validity in that given period"

What does it mean? What is a given period and how to change the training validity?

Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or if you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file after removing sensitive data.

 

Refer to:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

 

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Greg_Deckler
Community Champion
Community Champion

@Anony_mous Maybe:

Training Status Measure =
  VAR __Date = MAX('Table'[Date])
  VAR __Years = MAX('Table'[Training Validity])
  VAR __ValidTil = DATE(YEAR(__Date) + __Years, MONTH(__Date), DAY(__Date))
  VAR __Result = IF(__ValidTil >= TODAY(), "completed", "not completed")
RETURN
  __Result

If it is OK if it is valid until the end of the month then you could do this:

Training Status Measure =
  VAR __Date = MAX('Table'[Date])
  VAR __Years = MAX('Table'[Training Validity])
  VAR __ValidTil = EOMONTH(__Date, -12 * __Years)
  VAR __Result = IF(__ValidTil >= TODAY(), "completed", "not completed")
RETURN
  __Result


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.

Top Solution Authors