Forum Discussion
Calculating measure with multiple conditions (including previous months) for a card
- Anonymous3 years ago
Hi PierreCrunch ,
I have created a simple sample, please refer to it to see if it helps you.
Create columns.
month = MONTH(Sheet1[date])year = YEAR(Sheet1[date])Then create measures.
displays the sum of the balance in November
Measure = VAR _1month = MONTH ( EDATE ( TODAY (), -1 ) ) VAR _yyear = YEAR ( EDATE ( TODAY (), -1 ) ) RETURN CALCULATE ( SUM ( Sheet1[value] ), FILTER ( ALL ( Sheet1 ), Sheet1[month] = _1month && Sheet1[year] = _yyear ) )In you sample , you need to add Project Company.
Measure = VAR _1month = MONTH ( EDATE ( TODAY (), -1 ) ) VAR _yyear = YEAR ( EDATE ( TODAY (), -1 ) ) RETURN CALCULATE ( SUM ( Sheet1[value] ), FILTER ( ALL ( Sheet1 ), Sheet1[month] = _1month && Sheet1[year] = _yyear&&sheet1[Company]="Project Company" ) )Pay attention to letter case.
Measure2 = VAR _1month = MONTH ( EDATE ( TODAY (), -2 ) ) VAR _yyear = YEAR ( EDATE ( TODAY (), -1 ) ) RETURN CALCULATE ( SUM ( Sheet1[value] ), FILTER ( ALL ( Sheet1 ), Sheet1[month] = _1month && Sheet1[year] = _yyear ) )In you sample , you also need to add Project Company.
Measure2 = VAR _1month = MONTH ( EDATE ( TODAY (), -2 ) ) VAR _yyear = YEAR ( EDATE ( TODAY (), -1 ) ) RETURN CALCULATE ( SUM ( Sheet1[value] ), FILTER ( ALL ( Sheet1 ), Sheet1[month] = _1month && Sheet1[year] = _yyear&& Sheet1[year] = _yyear&&sheet1[Company]="Project Company" ) )How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi PierreCrunch ,
I have created a simple sample, please refer to it to see if it helps you.
Create columns.
month = MONTH(Sheet1[date])year = YEAR(Sheet1[date])
Then create measures.
displays the sum of the balance in November
Measure =
VAR _1month =
MONTH ( EDATE ( TODAY (), -1 ) )
VAR _yyear =
YEAR ( EDATE ( TODAY (), -1 ) )
RETURN
CALCULATE (
SUM ( Sheet1[value] ),
FILTER ( ALL ( Sheet1 ), Sheet1[month] = _1month && Sheet1[year] = _yyear )
)
In you sample , you need to add Project Company.
Measure =
VAR _1month =
MONTH ( EDATE ( TODAY (), -1 ) )
VAR _yyear =
YEAR ( EDATE ( TODAY (), -1 ) )
RETURN
CALCULATE (
SUM ( Sheet1[value] ),
FILTER ( ALL ( Sheet1 ), Sheet1[month] = _1month && Sheet1[year] = _yyear&&sheet1[Company]="Project Company" )
)
Pay attention to letter case.
Measure2 =
VAR _1month =
MONTH ( EDATE ( TODAY (), -2 ) )
VAR _yyear =
YEAR ( EDATE ( TODAY (), -1 ) )
RETURN
CALCULATE (
SUM ( Sheet1[value] ),
FILTER ( ALL ( Sheet1 ), Sheet1[month] = _1month && Sheet1[year] = _yyear )
)
In you sample , you also need to add Project Company.
Measure2 =
VAR _1month =
MONTH ( EDATE ( TODAY (), -2 ) )
VAR _yyear =
YEAR ( EDATE ( TODAY (), -1 ) )
RETURN
CALCULATE (
SUM ( Sheet1[value] ),
FILTER ( ALL ( Sheet1 ), Sheet1[month] = _1month && Sheet1[year] = _yyear&& Sheet1[year] = _yyear&&sheet1[Company]="Project Company" )
)
How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- PierreCrunch3 years agoFrequent Visitor
Hello,
sorry for the late answer. In the end we had to finish a first version of the report, so we went with a non-dynamic solution. Now I was able to check out your response, and it worked out for me! Will implement it now.
Thanks for the help!