Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi,
Request your guidance to overcome this issue
My Boss wants to compare the sales of current day ( say 03rd September 2022 ) with sales of same date of last month ( i.e. 03rd August 2022). I got a slicer for selecting the date, so if we select 03rd September 2022 it will show the sales for today but how can we display sales for the same day on last month ( 03rd August 2022). We have to consider months with 31 days / 30 days etc.
kindly advice
regards,
dsmitha
Solved! Go to Solution.
@dsmitha Maybe:
Measure =
VAR __Date = MAX('Table'[Date])
VAR __EOLM = EOMONTH(__Date,-1)
VAR __EOLMDay = DAY(__EOLM)
VAR __Day = DAY(__Date)
VAR __LMDay = IF(__EOLMDay < __Day, __Day, __EOLMDay)
VAR __LMDate = DATE(YEAR(__EOLM),MONTH(__EOLM),__LMDay)
RETURN
SUMX(FILTER(ALLSELECTED('Table',[Date]=__LMDate),[Sales])
Hi,
If the date selected is July 31, 2022, then what would be the date of the "same day last month"?
@dsmitha Maybe:
Measure =
VAR __Date = MAX('Table'[Date])
VAR __EOLM = EOMONTH(__Date,-1)
VAR __EOLMDay = DAY(__EOLM)
VAR __Day = DAY(__Date)
VAR __LMDay = IF(__EOLMDay < __Day, __Day, __EOLMDay)
VAR __LMDate = DATE(YEAR(__EOLM),MONTH(__EOLM),__LMDay)
RETURN
SUMX(FILTER(ALLSELECTED('Table',[Date]=__LMDate),[Sales])
Hi Greg_Deckler,
Thank you very much for your super quick solution, it worked fine
thanks again
dsmitha
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
145 | |
87 | |
66 | |
52 | |
45 |
User | Count |
---|---|
215 | |
90 | |
83 | |
66 | |
58 |