Forum Discussion
Calculation help needed
- Anonymous5 years ago
Hi srk_powerbi ,
Based on your description, you can create some measures as follows.
count_today = CALCULATE(COUNT('Table 1'[AccountNum]),'Table 1'[RegisteredDate]=TODAY()-1)
count_previous =
var x1 = MAXX(FILTER(ALL('Table 1'),[RegisteredDate]<TODAY()-1&&WEEKDAY('Table 1'[RegisteredDate],2)<6),'Table 1'[RegisteredDate])
return
CALCULATE(COUNT('Table 1'[AccountNum]),'Table 1'[RegisteredDate]=x1)
sum_today = CALCULATE(SUM('Table 2'[Amount]),'Table 1'[RegisteredDate]=TODAY()-1)
sum_previous =
var x1 = MAXX(FILTER(ALL('Table 1'),[RegisteredDate]<TODAY()-1&&WEEKDAY('Table 1'[RegisteredDate],2)<6),'Table 1'[RegisteredDate])
return
CALCULATE(SUM('Table 2'[Amount]),'Table 1'[RegisteredDate]=x1)Result:
Hope that's what you were looking for.
Best Regards,
Yuna
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
srk_powerbi , Create a date Table with following columns
Work Day = if(WEEKDAY([Date],2)>=6,0,1)
Work Date = if(WEEKDAY([Date],2)>=6,BLANK(),[Date])
Work Date Cont = if([Work Day]=0,maxx(FILTER('Date',[Date]<EARLIER([Date]) && [Work Day]<> EARLIER([Work Day]) ),[Date]),[Date])
Work Date cont Rank = RANKX(ALL('Date'),[Work Date Cont],,ASC,Dense)
Join it with Register Date
This Day = CALCULATE(sum('Table'[Amount]), FILTER(ALL('Date'),'Date'[Work Date cont Rank]=max('Date'[Work Date cont Rank])))
Last work day = CALCULATE(sum('Table'[Amount]), FILTER(ALL('Date'),'Date'[Work Date cont Rank]=max('Date'[Work Date cont Rank])-1))
diff =[This Day] - [Last work day]