Forum Discussion

utkarsh9771's avatar
utkarsh9771
New Member
2 years ago
Solved

LMTD using date slicer selection

Hello Experts!   Need help creating a logic Need to get sales for last month based on the user date selection For E.g. If I have selected 01-06-2024 and 12-06-2024 in my date slicer, I should...
  • Ashish_Mathur's avatar
    2 years ago

    Hi,

    Create a Calendar Table with a relationship (Many to One and Single) from the Date column of the Fact Table to the Date column of the Calendar Table.  To your slicer, drag Date from the Calendar Table and select a range of dates.  Write this measure

    Sales = sum(Data[Amount])

    Sales in same period last month = calculate([Sales],datesbetween(calendar[date],edate(min(calendar[date]),-1),edate(max(calendar[date]),-1)))

    Hope this helps.