Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Non-empty running total

Hello everyone,   I found this DAX code to calculate a yearly running total :       Qty Invoiced running total in Month = CALCULATE( SUM('Revenue'[Qty Invoiced]), FILTER( ALLSELECTED('Rev...
  • amitchandak's avatar
    5 years ago

    Anonymous  Use date table that will make sure you have data for the month you do not have data

     

    Qty Invoiced running total in Month = 
    CALCULATE(
    	SUM('Revenue'[Qty Invoiced]),
    	FILTER(
    		ALLSELECTED('Date'),
    		'Date'[Year] = MAX ( 'Date'[Year] ) &&
            'Date'[Month] <= MAX ( 'Date'[Month] )
    	)
    )

     

    to means this seem like YTD only

    YTD Sales = CALCULATE(SUM(Revenue[Qty Invoiced]),DATESYTD('Date'[Date],"12/31"))

     

    for runnign total

    Qty Invoiced running total in Month = 
    CALCULATE(
    	SUM('Revenue'[Qty Invoiced]),
    	FILTER(
    		ALLSELECTED('Date'),
    		'Date'[DAte]  <= MAX ( 'Date'[Date] )
    	)
    )