如何使 make-series 以另一个值为条件?
How to make make-series conditional on another value?
我正在使用查询来计算两个值,但我需要每个系列在计算中只包含特定类型的记录
let _timePeriodInHours = abs(datetime_diff('hour', _startTime, _endTime));
let _stepConfig = case(_timePeriodInHours <= 24, timespan(1h), _timePeriodInHours < 720, timespan(1d), timespan(30d));
tilldevicedata
| where todatetime(TransactionTimeStampUtc) between (_startTime.._endTime)
| where Brand has_any (_brand)
| where Country == _country
| where Store has_any (_store)
| where TransactionValueDiscount == 0
| where IsReturnTransaction == 0
| make-series AvgBasketValueNonDiscountedBaskets = round(avg(TransactionValueGross), 2), AvgBasketValueDiscountedBaskets = round(avg(TransactionValueNet), 2) on todatetime(TransactionTimeStampUtc) from bin(_startTime,_stepConfig) to _endTime step _stepConfig
我希望 AvgBasketValueNonDiscountedBaskets 的制作系列只包括 TransactionValueDiscount == 0 的行,我希望 AvgBasketValueDiscountedBaskets 只包括 TransactionValueDiscount > 0 的行
这能实现吗?
| make-series AvgBasketValueNonDiscountedBaskets = round(avgif(TransactionValueGross, TransactionValueDiscount == 0), 2), AvgBasketValueDiscountedBaskets = round(avgif(TransactionValueNet, TransactionValueDiscount > 0), 2) on todatetime(TransactionTimeStampUtc) from bin(_startTime,_stepConfig) to _endTime step _stepConfig
我正在使用查询来计算两个值,但我需要每个系列在计算中只包含特定类型的记录
let _timePeriodInHours = abs(datetime_diff('hour', _startTime, _endTime));
let _stepConfig = case(_timePeriodInHours <= 24, timespan(1h), _timePeriodInHours < 720, timespan(1d), timespan(30d));
tilldevicedata
| where todatetime(TransactionTimeStampUtc) between (_startTime.._endTime)
| where Brand has_any (_brand)
| where Country == _country
| where Store has_any (_store)
| where TransactionValueDiscount == 0
| where IsReturnTransaction == 0
| make-series AvgBasketValueNonDiscountedBaskets = round(avg(TransactionValueGross), 2), AvgBasketValueDiscountedBaskets = round(avg(TransactionValueNet), 2) on todatetime(TransactionTimeStampUtc) from bin(_startTime,_stepConfig) to _endTime step _stepConfig
我希望 AvgBasketValueNonDiscountedBaskets 的制作系列只包括 TransactionValueDiscount == 0 的行,我希望 AvgBasketValueDiscountedBaskets 只包括 TransactionValueDiscount > 0 的行
这能实现吗?
| make-series AvgBasketValueNonDiscountedBaskets = round(avgif(TransactionValueGross, TransactionValueDiscount == 0), 2), AvgBasketValueDiscountedBaskets = round(avgif(TransactionValueNet, TransactionValueDiscount > 0), 2) on todatetime(TransactionTimeStampUtc) from bin(_startTime,_stepConfig) to _endTime step _stepConfig