March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi All,
I have daily data need to calculate every month last date value i did using below measure it's working fine, But if i select multiple month on slicer it should sum of selected month last day values.
Please suggest how to achieve
Thanks in advance
MS
Solved! Go to Solution.
Yes @Varan_15 - because of summation we are getting 86.22
if it is monthly selection , what is expections.
Hope it helps
Proud to be a Super User! | |
Hi @Varan_15 - can you try below measure to calculate last day for selected months
Measure =
VAR LastDayOfEachMonth =
SUMMARIZE(
'Calendar',
'Calendar'[YearMonth], // Assuming you have a YearMonth column in your Calendar table
"LastDay", MAX('Calendar'[Date])
)
RETURN
SUMX(
LastDayOfEachMonth,
CALCULATE(SUM(Sales[Saving]), 'Calendar'[Date] = [LastDay])
)
Hope it works.
Proud to be a Super User! | |
Thanks for the update, As i have 5 columns in calander table and i tried above same measure but it's showing error like "LastDay" column cannot be found.
error: Column 'LastDay' cannot be found or may not be used in this expression.
Regards,
MS
Hi @Varan_15 - can you please share sample data as well in text format. will check at our end.
i have modified to take reference from calendar table.
Measure =
VAR SelectedMonths = VALUES('Calendar'[YearMonth])
VAR LastDays =
SUMMARIZE(
FILTER(
ALL('Calendar'),
'Calendar'[YearMonth] IN SelectedMonths
),
'Calendar'[YearMonth],
"LastDay", MAX('Calendar'[Date])
)
VAR Result =
SUMX(
LastDays,
CALCULATE(
SUM(Sales[Saving]),
Sales[Days] = [LastDay]
)
)
RETURN
Result
can you check above still error, please share sample copy of data(dummy) text copy .
Hope it works.
Proud to be a Super User! | |
Still same error "Column 'LastDay' cannot be found or may not be used in this expression."
attached sample data here:
Day Area Branch Code Saving
16-May-24 CAPITAL 101 28.17
23-May-24 CAPITAL 101 29.22
30-May-24 CAPITAL 101 28.83
06-Jun-24 CAPITAL 101 26.73
13-Jun-24 CAPITAL 101 24.53
20-Jun-24 CAPITAL 101 23.53
30-Jun-24 CAPITAL 101 23.84
Hi @Varan_15 - Thanks for sharing,
can you check the below measure: rename your table name and coumns
Hope it works
Proud to be a Super User! | |
Thanks for your effort.
it's fetching month last day as expected but if i select MAY and JUN month using slicer then it should add total value ( 30th May value + 30th June value ) = 28.83+23.84 so total will be 52.67
based on month selection it should be sum of value.
Thanks,
MS
Hi @Varan_15 - create below two measure, one for last day of month another summation of each month selection.
replace table name as per your model.
Measure 1:
if we select june and may below is the result.
Proud to be a Super User! | |
Thanks for your update, Please note the slicer will be monthly only not daily so as per your measure if i select month then it's calculating all the day of that particular month hence the answer is worng.
if i select May month then it's appearing 86.22 which is sum of all the days . please suggest
Thanks in advance
Yes @Varan_15 - because of summation we are getting 86.22
if it is monthly selection , what is expections.
Hope it helps
Proud to be a Super User! | |
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
128 | |
90 | |
75 | |
56 | |
53 |
User | Count |
---|---|
200 | |
104 | |
101 | |
67 | |
55 |