Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi all,
I'm pretty new to power bi so I would like some help on this
I am trying to calculate the month difference between the max date and the selected date
I tried 2 different methods:
Method 1 using today() and it worked well
Solved! Go to Solution.
Hi @darlingling520 ,
You could try this:-
datediff2 =
var max_date = calculate(max(DATA[date]),ALL(DATA[date]))
return DATEDIFF(SELECTEDVALUE(DATA[date]),max_date,MONTH)
BR,
Samarth
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
okay I already figured out myself - in order to use the max function
i need to use maxdate= calculate(max(data[date]),all(data)); so the max date will be fixed and therefore i can use it to calculate the datediff
okay I already figured out myself - in order to use the max function
i need to use maxdate= calculate(max(data[date]),all(data)); so the max date will be fixed and therefore i can use it to calculate the datediff
Hi @darlingling520 ,
You could try this:-
datediff2 =
var max_date = calculate(max(DATA[date]),ALL(DATA[date]))
return DATEDIFF(SELECTEDVALUE(DATA[date]),max_date,MONTH)
BR,
Samarth
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
thanks so much!!
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 |
---|---|
61 | |
56 | |
55 | |
36 | |
34 |
User | Count |
---|---|
77 | |
73 | |
45 | |
45 | |
43 |