Search code examples
powerbidaxdashboard

Previous month and current month values should reflect when selecting in month filter


MTDValu = [SumAmount] (DATESMTD(LedgerSummaryUnion[Date]))
    
MTDPerce = FORMAT(DIVIDE(MTDValu,[CurrentMTDRev]),"0.0%")
    
PreMTD = CALCULATE([MTD],(PREVIOUSMONTH(DATESMTD(LedgerSummaryUnion[Date]))))
    
Premtd= CALCULATE([SumAmount],(PREVIOUSMONTH(DATESMTD(LedgerSummaryUnion[Date]))))
    
MTD Varian = [MTD]-[Prev MTD]
    
MTD Varian % = FORMAT(DIVIDE([MTD],[CurrentMTDRev])-DIVIDE([Prev MTD],[PreviousMTDRev]),"0.0%")
    
CurrentMTDRev = CALCULATE(LedgerSummaryUnion[SumMonthRev],DATESMTD(LedgerSummaryUnion[Date]))
    
SumMonthRev = ABS(CALCULATE(SUM(LedgerSummaryUnion[MonthRevenue])/100000))

these are some measures i wrote for calculating current month and previous month values, but while selecting current month previous month value should also reflect, need help in this. Do i need to change my dax or anything else? enter image description here

enter image description here in the above attached file, if i click may i get current mtd details but previous mtd details are not reflecting. I need previous mtd details also, please help. I need to show the requirement to client by evening.

This is the link for the pbix file

enter image description here- ledgersummaryunionn table enter image description here- Image after using debug measures


Solution

  • You forgot to mention that your Month slicer is from another table.

    Update your measure to:

    PreMTD = 
      CALCULATE(
        [MTD],
        REMOVEFILTERS(PBI_Dates),
        PREVIOUSMONTH(LedgerSummaryUnion[Date])
      )