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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Dax for populating Date by condition

Hi All,

 

i'm trying to write a DAX to calculate the Provision date of a packages that our customre have gotten.

Below is the Current Provision date :

Provision Date = CALCULATE( minx(overall,Overall[DateIn]) ,ALLEXCEPT ( Overall, Overall[CHASSIS],Overall[Package Name]),Overall[Category]="Provision")
 
CHASSISCategoryProvisionUtilisationClosing BalanceDateInPackage NameProvision Date
W17144Provision1140 11409/10/2015Tweet9/10/2015
W17144Utilisation -$380.-3809/10/2015Tweet9/10/2015
W17144Utilisation -$380.-38025/6/2016Tweet9/10/2015
W17144Utilisation -$380.-3801/4/2017Tweet9/10/2015
W17144Provision1026 102616/3/2018Tweet9/10/2015
W17144Utilisation -$380.-38020/3/2018Tweet9/10/2015
W17144Utilisation -$380.-38012/3/2019Tweet9/10/2015
W17144Utilisation -$380.-3804/3/2020Tweet9/10/2015
W17144Provision1026 10265/3/2021Tweet9/10/2015
W17144Utilisation -$380.-38015/3/2021Tweet9/10/2015

 

 

But i'm trying to dereive the below date instead:

THe provision date is based on the Category = Provision to derieve the date, any utilisation date that fall after the provision date will be using the Provision date until the next provision category was purchase then the provision date should be using re-populate. Any pro or guru able to provide their input?

 

Expected Result

CHASSISCategoryProvisionUtilisationClosing BalanceDateInPackage NameProvision Date
W17144Provision1140 11409/10/2015Tweet9/10/2015
W17144Utilisation -$380.-3809/10/2015Tweet9/10/2015
W17144Utilisation -$380.-38025/6/2016Tweet9/10/2015
W17144Utilisation -$380.-3801/4/2017Tweet9/10/2015
W17144Provision1026 102616/3/2018Tweet16/3/2018
W17144Utilisation -$380.-38020/3/2018Tweet16/3/2018
W17144Utilisation -$380.-38012/3/2019Tweet16/3/2018
W17144Utilisation -$380.-3804/3/2020Tweet16/3/2018
W17144Provision1026 10265/3/2021Tweet5/3/2021
W17144Utilisation -$380.-38015/3/2021Tweet5/3/2021
1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

Provision Date = 
MAXX(
    FILTER(
        Overall,
        Overall[CHASSIS] = EARLIER( Overall[CHASSIS] )
            && Overall[DateIn] <= EARLIER( Overall[DateIn] )
            && Overall[Category] = "Provision"
    ),
    Overall[DateIn]
)

Screenshot 2021-11-25 211022.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

3 REPLIES 3
VahidDM
Super User
Super User

Hi @Anonymous 

 

Try this measure:

Provision Date = 
CALCULATE (
    MAX ( Overall[DateIn] ),
    FILTER (
        ALL ( Overall ),
        Overall[Provision] <> BLANK ()
            && Overall[DateIn] <= MAX ( Overall[DateIn] )
    )
)

 

Output:

VahidDM_0-1637879294835.png

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

CNENFRNL
Community Champion
Community Champion

Provision Date = 
MAXX(
    FILTER(
        Overall,
        Overall[CHASSIS] = EARLIER( Overall[CHASSIS] )
            && Overall[DateIn] <= EARLIER( Overall[DateIn] )
            && Overall[Category] = "Provision"
    ),
    Overall[DateIn]
)

Screenshot 2021-11-25 211022.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

amitchandak
Super User
Super User

@Anonymous , Try like. New measure

 


Provision Date = CALCULATE( minx(overall,Overall[DateIn]) ,filter (allselected (Overall), Overall[CHASSIS] = max(Overall[CHASSIS]) && Overall[Package Name] = max(Overall[Package Name]) && Overall[Category]="Provision"))

 

 

or

 


Provision Date = CALCULATE( minx(overall,Overall[DateIn]) ,filter (all(Overall), Overall[CHASSIS] = max(Overall[CHASSIS]) && Overall[Package Name] = max(Overall[Package Name]) && Overall[Category]="Provision"))

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.