Forum Discussion
Anya_T
4 years agoFrequent Visitor
Sum of values
Hi, There is data in Year Month Values 2020 Jan 0 2020 Feb 0 2020 Mar 0 2020 Apr 0 2020 May 0 2020 Jun 0 2020 Jul 39785 2020 Aug 25375 2020 Sep ...
- 4 years ago
Hi Anya_T ,
Create a column with below code:-
H's = var month_num = Month(DATEVALUE('Table (6)'[Year]&"/"&'Table (6)'[Month ]&"/"&"1")) return if(month_num <= 6,"H1","H2")Now create a measure like this:-
Comparision = VAR H1_2020 = CALCULATE ( SUM ( 'Table (6)'[Values] ), 'Table (6)'[Year] = 2020, 'Table (6)'[H's] = "H1" ) VAR H1_2021 = CALCULATE ( SUM ( 'Table (6)'[Values] ), 'Table (6)'[Year] = 2021, 'Table (6)'[H's] = "H1" ) RETURN H1_2021 - H1_2020Thanks,
Samarth
Samarth_18
Community Champion
4 years agoHi Anya_T ,
Create a column with below code:-
H's =
var month_num = Month(DATEVALUE('Table (6)'[Year]&"/"&'Table (6)'[Month ]&"/"&"1"))
return if(month_num <= 6,"H1","H2")
Now create a measure like this:-
Comparision =
VAR H1_2020 =
CALCULATE (
SUM ( 'Table (6)'[Values] ),
'Table (6)'[Year] = 2020,
'Table (6)'[H's] = "H1"
)
VAR H1_2021 =
CALCULATE (
SUM ( 'Table (6)'[Values] ),
'Table (6)'[Year] = 2021,
'Table (6)'[H's] = "H1"
)
RETURN
H1_2021 - H1_2020
Thanks,
Samarth