Preppindata练习03|2023: Week 3 - Targets for DSB

Input

在这里插入图片描述

Requirements

  • Input the data

  • For the transactions file:

    • Filter the transactions to just look at DSB (help)
      • These will be transactions that contain DSB in the Transaction Code field
        在这里插入图片描述
        在这里插入图片描述
        Solution: selcted [PD 2023 Wk 3 Input], added “clean up" step, selected [transaction code] - [Filter] - [Calculation…], inserted formulas: LEFT([Transaction Code],3) = “DSB” , then saved it.
        在这里插入图片描述
        The result should look like this.
    • Rename the values in the Online or In-person field, Online of the 1 values and In-Person for the 2 values
      Solution: That is quite easy, just changed “numerous” type into “string” type first, then edited the values and renamed them seperately.
    • Change the date to be the quarter (help)
      在这里插入图片描述
      Solution: selected [transaction date] - “…” - “Convert Dates” - “Quarter number”, quarter means season.
    • Sum the transaction values for each quarter and for each Type of Transaction (Online or In-Person) (help)
      在这里插入图片描述
      Solution: added “aggregate” step, on the left side, selected [Settings] so that we can see all the fields here. Then dragged [transaction date] 、 [transaction date] into [Grouped Fields], dragged [sum value] into [Aggregated Fields].
  • For the targets file:

    • Pivot the quarterly targets so we have a row for each Type of Transaction and each Quarter (help)
      在这里插入图片描述
      Solution: added “pivot” step, selected “Colums to Rows”, moved “Q1”-“Q4” to [Pivoted Fields]
    • Rename the fields as [Quarter]
      在这里插入图片描述
    • Remove the ‘Q’ from the quarter field and make the data type numeric (help)
      在这里插入图片描述
  • Join the two datasets together (help)

    • You may need more than one join clause!
      在这里插入图片描述
      根据输出结果可知,最终输出的是8行,第一次join有32行,所以需要重新检查[Applied Join Calues]处哪里有问题,注意变量对应值的匹配,并且需要两个Calues才可以达到最终的结果。
  • Remove unnecessary fields
    在这里插入图片描述

  • Calculate the Variance to Target for each row (help)
    在这里插入图片描述
    计算变量[Variance to Target], 公式:[Value] - [Quarterly Target]

  • Output the data
    在这里插入图片描述

Output

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值