Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
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 :
CHASSIS | Category | Provision | Utilisation | Closing Balance | DateIn | Package Name | Provision Date |
W17144 | Provision | 1140 | 1140 | 9/10/2015 | Tweet | 9/10/2015 | |
W17144 | Utilisation | -$380. | -380 | 9/10/2015 | Tweet | 9/10/2015 | |
W17144 | Utilisation | -$380. | -380 | 25/6/2016 | Tweet | 9/10/2015 | |
W17144 | Utilisation | -$380. | -380 | 1/4/2017 | Tweet | 9/10/2015 | |
W17144 | Provision | 1026 | 1026 | 16/3/2018 | Tweet | 9/10/2015 | |
W17144 | Utilisation | -$380. | -380 | 20/3/2018 | Tweet | 9/10/2015 | |
W17144 | Utilisation | -$380. | -380 | 12/3/2019 | Tweet | 9/10/2015 | |
W17144 | Utilisation | -$380. | -380 | 4/3/2020 | Tweet | 9/10/2015 | |
W17144 | Provision | 1026 | 1026 | 5/3/2021 | Tweet | 9/10/2015 | |
W17144 | Utilisation | -$380. | -380 | 15/3/2021 | Tweet | 9/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
CHASSIS | Category | Provision | Utilisation | Closing Balance | DateIn | Package Name | Provision Date |
W17144 | Provision | 1140 | 1140 | 9/10/2015 | Tweet | 9/10/2015 | |
W17144 | Utilisation | -$380. | -380 | 9/10/2015 | Tweet | 9/10/2015 | |
W17144 | Utilisation | -$380. | -380 | 25/6/2016 | Tweet | 9/10/2015 | |
W17144 | Utilisation | -$380. | -380 | 1/4/2017 | Tweet | 9/10/2015 | |
W17144 | Provision | 1026 | 1026 | 16/3/2018 | Tweet | 16/3/2018 | |
W17144 | Utilisation | -$380. | -380 | 20/3/2018 | Tweet | 16/3/2018 | |
W17144 | Utilisation | -$380. | -380 | 12/3/2019 | Tweet | 16/3/2018 | |
W17144 | Utilisation | -$380. | -380 | 4/3/2020 | Tweet | 16/3/2018 | |
W17144 | Provision | 1026 | 1026 | 5/3/2021 | Tweet | 5/3/2021 | |
W17144 | Utilisation | -$380. | -380 | 15/3/2021 | Tweet | 5/3/2021 |
Solved! Go to Solution.
Provision Date =
MAXX(
FILTER(
Overall,
Overall[CHASSIS] = EARLIER( Overall[CHASSIS] )
&& Overall[DateIn] <= EARLIER( Overall[DateIn] )
&& Overall[Category] = "Provision"
),
Overall[DateIn]
)
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! |
Hi @Anonymous
Try this measure:
Provision Date =
CALCULATE (
MAX ( Overall[DateIn] ),
FILTER (
ALL ( Overall ),
Overall[Provision] <> BLANK ()
&& Overall[DateIn] <= MAX ( Overall[DateIn] )
)
)
Output:
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/
Provision Date =
MAXX(
FILTER(
Overall,
Overall[CHASSIS] = EARLIER( Overall[CHASSIS] )
&& Overall[DateIn] <= EARLIER( Overall[DateIn] )
&& Overall[Category] = "Provision"
),
Overall[DateIn]
)
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! |
@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"))
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
15 | |
10 | |
10 | |
10 | |
10 |
User | Count |
---|---|
19 | |
14 | |
13 | |
11 | |
8 |