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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
jcastr02
Post Prodigy
Post Prodigy

Date calculation with IF

I'd like to be able to create a calculated column or measure that would tell me the "Next Audit Date" based on the last audit date and the tier level.  Note that the "last audit date" is on another table.    Example, tier 1 next audit date is 365 days after last audit date, tier 2 is 2 years after, tier 3 is 3 years after etc.  

 

tier.png

 

 

1 ACCEPTED SOLUTION
v-henryk-mstf
Community Support
Community Support

Hi @jcastr02 ,

 

Is the last audit data the smallest date in each group of the audit data field in the compliance table? Then get the next audit date based on the grade. I did the following test:

Last_audit Name = 
CALCULATE (
    MIN ( 'Compliance table'[Audit Name] ),
    FILTER (
        ALL ( 'Compliance table' ),
        'Compliance table'[Document Name] = 'Document Table'[Document Name]
    )
)
next_audit Name = 'Document Table'[Last_audit Name].[Date]+'Document Table'[Tier level]*365

There is no need to establish any relationship between the other two tables.

v-henryk-mstf_0-1623728309418.png


If i misunderstand what you mean, can you further clarify your needs, such as a screenshot of the desired result. I will answer you as soon as possible. Looking forward to your reply.

Best Regards,
Henry

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

View solution in original post

3 REPLIES 3
v-henryk-mstf
Community Support
Community Support

Hi @jcastr02 ,

 

Is the last audit data the smallest date in each group of the audit data field in the compliance table? Then get the next audit date based on the grade. I did the following test:

Last_audit Name = 
CALCULATE (
    MIN ( 'Compliance table'[Audit Name] ),
    FILTER (
        ALL ( 'Compliance table' ),
        'Compliance table'[Document Name] = 'Document Table'[Document Name]
    )
)
next_audit Name = 'Document Table'[Last_audit Name].[Date]+'Document Table'[Tier level]*365

There is no need to establish any relationship between the other two tables.

v-henryk-mstf_0-1623728309418.png


If i misunderstand what you mean, can you further clarify your needs, such as a screenshot of the desired result. I will answer you as soon as possible. Looking forward to your reply.

Best Regards,
Henry

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

amitchandak
Super User
Super User

@jcastr02 , need more data, but you have try like

new column in table 1

minx(filter(Table2, Table1[tire level] =Table2[tire level] && Table1[last Audit date] <Table2[next audit date]),Table2[next audit date])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak    I have two table like below with the document Name being the unique id.  Tier 1 - Audit every 1 year, Tier 2 - Audit every 2 years, and Tier 3 Audit every 3 years.  Based on the last audit, seeking to find the next audit date for a document.    (sorry it wouldn't let me add table below with data, so include a screen capture)

 

Table Example.png

 

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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