Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi, I have the below measure which calculates the number of days between two dates filtered by the datebetween function. I only want to show this measure when it falls between the dates provided in DateBetween. This works until I add the +1, then it provides a value against all dates (see image). How do I add 1 without breaking the filter?
MEASURE Charge[RentalDaysUsed] =
CALCULATE (
DATEDIFF ( [CurrentRentalFromDate], MAX ( Charge[dtChargeDate1] ), DAY ) + 1,
DATESBETWEEN (
Charge[dtChargeDate1],
[CurrentRentalFromDate],
MAX ( Charge[dtChargeDate1] )
)
)
Solved! Go to Solution.
Thansk for the reply but I fixed this by adding a FILTER instead of the DATESBETWEEN:
Thansk for the reply but I fixed this by adding a FILTER instead of the DATESBETWEEN:
Hi @gclements ,
You could try something like this:
Charge[RentalDaysUsed] =
VAR __daysUsed =
CALCULATE(
DATEDIFF(
[CurrentRentalFromDate],
MAX(Charge[dtChargeDate1]),
DAY
),
DATESBETWEEN(
Charge[dtChargeDate1],
[CurrentRentalFromDate],
MAX(Charge[dtChargeDate1])
)
)
RETURN
SWITCH(
TRUE(),
ISBLANK(__daysUsed), BLANK(),
__daysUsed + 1
)
Not the most elegant solution, but should get you over the line.
Pete
Proud to be a Datanaut!
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
72 | |
69 | |
37 | |
29 | |
25 |
User | Count |
---|---|
89 | |
49 | |
44 | |
38 | |
37 |