Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Dynamic Previous and Current Total Sales Calculation

  Hi All,   I'm wanting to show monthly YTD changes in sales number. If no financial period slicer is selected, I want to show sales figures for the current month and sales figures from last mo...
  • MFelix's avatar
    4 years ago

    Hi Anonymous ,

     

    Without any data is difficult to give you the correct answer however believe that your measures are lacking the context  especially the last one try the following:

    YTD Sales till last month =
    CALCULATE (
        SUM ( Sales[Sales Amount] ),
        DATESYTD ( 'Date'[Date], "06/30" ),
        FILTER ( ALL ( 'Date'[Date] ), 'Date'[Date] <= EOMONTH ( MAX ( 'Date'[Date] ), -1 ) )
    )
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous ,

    Please update the formula of measure [YTD Sales till last month] as below:

    YTD Sales till last month = CALCULATE ( [YTD Sales], PREVIOUSMONTH ( 'Date'[Date] ) )

    Alternatively, since we don't know which fields you have applied as slicer options, we can't give you the appropriate measure. You can refer to the following blog to determine if the slicer has any options selected and change your measure based on your scenario.

    No slicer selected — No chart in Power BI

    If the above ones can't help you find the solution, please provide more details(sample data, slicer setting or your sample pbix file etc.) for your requirement. Thank you.

    Best Regards