Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I am struggling with a calculation of measure with 2 dates.
My table below has 2 dates. Trying to calculate sum of quantity by revision dates. My filter is on Calendar date which has an active relation with revision date.
expected result
Sum for selected date of oct15 , should be only 35( excluding the 6th Nov Purch Date ) . Basically, depends on the calendar day selection, total should be only with Purch date of Selected date month. I tried using userelationship, but that didn't work.
Any advice will help.
My pbix is https://drive.google.com/file/d/1cMeCbzFtPWDP-ABJ0itxiwnlc_T2QIFr/view?usp=sharing
Solved! Go to Solution.
Hi,
You may download my PBI file from here.
Hope this helps.
Hey @Pbi07 ,
next to the solution provided by @Ashish_Mathur , here is another approach that only makes use of the tables
Tom =
var MAXSelectedDate = MAX('Calendar'[Date] )
var SelectedYear = YEAR( MAXSelectedDate )
var SelectedMonth = MONTH( MAXSelectedDate )
var EoMofSelectedDate = EOMONTH( MAXSelectedDate , 0 )
var __AllPurchDatesInSelectedMonth = DATESBETWEEN( 'Calendar'[Date] , DATE( SelectedYear , SelectedMonth , 1) , EoMofSelectedDate )
return
CALCULATE(
SUM( 'Revision Table'[Quantity] )
, 'Revision Table'[Purch Date] IN __AllPurchDatesInSelectedMonth
)
A little screenshot:
Hopefully, this provides what you are looking for.
Regards,
Tom
Hey @Pbi07 ,
next to the solution provided by @Ashish_Mathur , here is another approach that only makes use of the tables
Tom =
var MAXSelectedDate = MAX('Calendar'[Date] )
var SelectedYear = YEAR( MAXSelectedDate )
var SelectedMonth = MONTH( MAXSelectedDate )
var EoMofSelectedDate = EOMONTH( MAXSelectedDate , 0 )
var __AllPurchDatesInSelectedMonth = DATESBETWEEN( 'Calendar'[Date] , DATE( SelectedYear , SelectedMonth , 1) , EoMofSelectedDate )
return
CALCULATE(
SUM( 'Revision Table'[Quantity] )
, 'Revision Table'[Purch Date] IN __AllPurchDatesInSelectedMonth
)
A little screenshot:
Hopefully, this provides what you are looking for.
Regards,
Tom
Hi,
You may download my PBI file from here.
Hope this helps.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
95 | |
77 | |
65 | |
53 |
User | Count |
---|---|
144 | |
105 | |
102 | |
89 | |
63 |