DAX - 根据今天的日期绘制前一个工作日值
DAX - Plot Previous working day value against today's date
我有一个这样的table,
ReportingDate ReportingDateOrder Status Customer
01/06/2021 1 Active Present
01/06/2021 1 Active
01/06/2021 1 Inactive Present
27/05/2021 2 Inactive Present
27/05/2021 2 Active Present
27/05/2021 2 Active Present
26/05/2021 3 Active Present
我想生成这样的视觉效果 table,
ReportingDate PreviousDaySales
01/06/2021 2
27/05/2021 1
26/05/2021 0
previousdaysales 的逻辑是上一个可用报告日期的活动行数。
这是我迄今为止尝试过的方法,但它返回的是空的。
PreviousDaySales =
var selectedreportingdate = SELECTEDVALUE('Table1'[Reporting Date])
var selectedreportingrank = CALCULATE(MIN('Table1'[ReportingDateOrder]),FILTER('Table1', 'Table1'[Reporting Date] = selectedreportingdate))
var old_rank = selectedreportingrank + 1
var val1 = CALCULATE(COUNT('Table1'[Action Status]), FILTER('Table1', 'Table1'[Status] = "Active" && 'Table1'[ReportingDateOrder] = old_rank))
return val1
请帮我解决这个问题。
CurrentActiveLines :=
CALCULATE(COUNTROWS(RStatus),RStatus[Status]="Active")
PreviousReportingDateActiveLines :=
VAR CurrentDate = SELECTEDVALUE( RStatus[ReportingDate] )
VAR PreviousDate =
CALCULATE(
LASTDATE( RStatus[ReportingDate] ),
RStatus[ReportingDate] < CurrentDate
)
VAR Result =
CALCULATE(
COUNTROWS( RStatus ),
RStatus[ReportingDate] = PreviousDate,
RStatus[Status] = "Active"
)
RETURN
Result
我有一个这样的table,
ReportingDate ReportingDateOrder Status Customer
01/06/2021 1 Active Present
01/06/2021 1 Active
01/06/2021 1 Inactive Present
27/05/2021 2 Inactive Present
27/05/2021 2 Active Present
27/05/2021 2 Active Present
26/05/2021 3 Active Present
我想生成这样的视觉效果 table,
ReportingDate PreviousDaySales
01/06/2021 2
27/05/2021 1
26/05/2021 0
previousdaysales 的逻辑是上一个可用报告日期的活动行数。
这是我迄今为止尝试过的方法,但它返回的是空的。
PreviousDaySales =
var selectedreportingdate = SELECTEDVALUE('Table1'[Reporting Date])
var selectedreportingrank = CALCULATE(MIN('Table1'[ReportingDateOrder]),FILTER('Table1', 'Table1'[Reporting Date] = selectedreportingdate))
var old_rank = selectedreportingrank + 1
var val1 = CALCULATE(COUNT('Table1'[Action Status]), FILTER('Table1', 'Table1'[Status] = "Active" && 'Table1'[ReportingDateOrder] = old_rank))
return val1
请帮我解决这个问题。
CurrentActiveLines :=
CALCULATE(COUNTROWS(RStatus),RStatus[Status]="Active")
PreviousReportingDateActiveLines :=
VAR CurrentDate = SELECTEDVALUE( RStatus[ReportingDate] )
VAR PreviousDate =
CALCULATE(
LASTDATE( RStatus[ReportingDate] ),
RStatus[ReportingDate] < CurrentDate
)
VAR Result =
CALCULATE(
COUNTROWS( RStatus ),
RStatus[ReportingDate] = PreviousDate,
RStatus[Status] = "Active"
)
RETURN
Result