Quicksight KPI on last month spending vs average three months spending

0

CUDOs billing summary page Hi,

Thank you for making the CUDOs template. I have a question about the KPI table. Is it possible to get the last three months average spend vs last month total spend using the KPI table? For example, in the screenshot took from the public template dashboard, I would like to get (Nov 2022 + Dec 2022 + Jan 2023)/3 vs Feb 2023, which would be (1.04M + 0.93763M + 0.75624M)/3 vs 0.6443M

Thank you!

已提問 1 年前檢視次數 259 次
1 個回答
0

My attempt:

  1. monthTruncDate: truncdate("MM",{billing_period})
  2. LastMonthSpending: ifelse(dateDiff(monthTruncDate,maxOver(monthTruncDate,[],PRE_AGG), 'MM') = 1, {unblended_cost}, 0)
  3. LastThreeMonthSpendingAverage: ifelse( dateDiff(monthTruncDate, maxOver(monthTruncDate,[],PRE_AGG), 'MM') = 2, {unblended_cost}, dateDiff(monthTruncDate, maxOver(monthTruncDate,[],PRE_AGG), 'MM') = 3, {unblended_cost}, dateDiff(monthTruncDate, maxOver(monthTruncDate,[],PRE_AGG), 'MM') = 4, {unblended_cost}, 0)/3

I checked against the cost explorer and I think LastMonthSpending value is correct but LastThreeMonthSpendingAverage is slightly off by about 0.7 dollar. Can someone help me check if my approach is correct and scalable? Thank you.

已回答 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南