Forum Discussion
Visual Calculation_ Total per Category
- 1 year ago
Hi AllanBerces
Please change the measure as follows which would sum up by date:Overall Total by Cat. = VAR CurrentDate = SELECTEDVALUE(CatSum2[Date]) VAR CurrentGroup = SELECTEDVALUE(CatSum2[Group]) RETURN CALCULATE( SUM(CatSum2[Current Total Hrs]), FILTER( ALL(CatSum2), CatSum2[Date] = CurrentDate && CatSum2[Group] = CurrentGroup ) )If you would like to particularly filter for the current date, use the following:
Overall Total by Cat. = VAR FixedDate = TODAY() VAR CurrentGroup = SELECTEDVALUE(CatSum2[Group]) RETURN CALCULATE( SUM(CatSum2[Current Total Hrs]), FILTER( ALL(CatSum2), CatSum2[Full Date] = FixedDate && CatSum2[Group] = CurrentGroup ) )
If you have a flag column to filter to today's date feel free to use that as well.
As mentioned for Visual level calculation, you could use:VisualCalcTrial = SUMX( WINDOW( 1, ABS, -1, ABS, ROWS, , , PARTITIONBY([Group]) ), [Sum of Current Total Hrs] )
but again you would have to filter by the date and add the group column - 1 year ago
Hi AllanBerces
For column use either of these DAX for calculated columns based on your requirement:OverallTotalByCat_Col 2 = VAR CurrentDate = CatSum2[Date] VAR CurrentGroup = CatSum2[Group] RETURN CALCULATE( SUM(CatSum2[Current Total Hrs]), FILTER( CatSum2, CatSum2[Date] = CurrentDate && CatSum2[Group] = CurrentGroup ) )
With fixed date:OverallTotalByCat_Col 2 = VAR FixedDate = TODAY() VAR CurrentGroup = CatSum2[Group] RETURN CALCULATE( SUM(CatSum2[Current Total Hrs]), FILTER( CatSum2, CatSum2[Full Date] = FixedDate && CatSum2[Group] = CurrentGroup ) )
Mark as solution to guide others!
Hi MohamedFowzan1 thank you very much, but the Overall Total by cat should be SouthEast= 44,359.18 and South =10,943.6., sum only of the current date.
Hi AllanBerces
Please change the measure as follows which would sum up by date:
Overall Total by Cat. =
VAR CurrentDate = SELECTEDVALUE(CatSum2[Date])
VAR CurrentGroup = SELECTEDVALUE(CatSum2[Group])
RETURN
CALCULATE(
SUM(CatSum2[Current Total Hrs]),
FILTER(
ALL(CatSum2),
CatSum2[Date] = CurrentDate &&
CatSum2[Group] = CurrentGroup
)
)
If you would like to particularly filter for the current date, use the following:
Overall Total by Cat. =
VAR FixedDate = TODAY()
VAR CurrentGroup = SELECTEDVALUE(CatSum2[Group])
RETURN
CALCULATE(
SUM(CatSum2[Current Total Hrs]),
FILTER(
ALL(CatSum2),
CatSum2[Full Date] = FixedDate &&
CatSum2[Group] = CurrentGroup
)
)
If you have a flag column to filter to today's date feel free to use that as well.
As mentioned for Visual level calculation, you could use:
VisualCalcTrial =
SUMX(
WINDOW(
1,
ABS,
-1,
ABS,
ROWS,
,
,
PARTITIONBY([Group])
),
[Sum of Current Total Hrs]
)
but again you would have to filter by the date and add the group column
- AllanBerces1 year agoPost Prodigy
Hi MohamedFowzan1 techies Ahmedx TomMartens thank you very much for the reply working all good, im just wondering how can i convert this also in calculated column. thank you all
- MohamedFowzan11 year agoSuper User
Hi AllanBerces
For column use either of these DAX for calculated columns based on your requirement:OverallTotalByCat_Col 2 = VAR CurrentDate = CatSum2[Date] VAR CurrentGroup = CatSum2[Group] RETURN CALCULATE( SUM(CatSum2[Current Total Hrs]), FILTER( CatSum2, CatSum2[Date] = CurrentDate && CatSum2[Group] = CurrentGroup ) )
With fixed date:OverallTotalByCat_Col 2 = VAR FixedDate = TODAY() VAR CurrentGroup = CatSum2[Group] RETURN CALCULATE( SUM(CatSum2[Current Total Hrs]), FILTER( CatSum2, CatSum2[Full Date] = FixedDate && CatSum2[Group] = CurrentGroup ) )
Mark as solution to guide others!- AllanBerces1 year agoPost Prodigy
Hi MohamedFowzan1 thank you very much working perfectly