Forum Discussion

sprather's avatar
sprather
Frequent Visitor
9 years ago
Solved

Average Daily Spend by Month

New to PowerBI. I have the following data that I want to be able to see the average daily spending by month. So for the current month we are on day 19. I want to use the # of days in the month if it ...
  • v-huizhn-msft's avatar
    v-huizhn-msft
    9 years ago

    Hi sprather,

    >>So for example today is day 22 of May. This report should show the owners if they pull up the portal for spending what our average daily spend is for May. So if we have spent 25000 through the 21st 

    You can create a measure to get your result.

    Average_Current=CALCULATE(SUM(Table[price]),FILTER(Table, Table[Month]=MAX(Table[Month])))/CALCULATE(COUNT(Table[purchase_date]),FILTER(Table, Table[Month]=MAX(Table[Month])&&FILTER(Table, Table[purchase_date]<MAX(Table[purchase_date])))


    >>Ideally be able to pull up historical data as well so they can compare over time the average daily spending by month. 

    Please try to create the following formula, please test it using your sample data.

    average = Var currentmonth=MAX(Table[Month])
    RETURN 
    IF(
    	FIRSTNONBLANK(MAX(Table[Month]),1)=currentmonth,
    	Table[Average_Current],
    	CALCULATE(AVERAGE(Table[price]),FILTER(Table,Table[Month]))
    	
    )
    


    Best Regards,
    Angelia