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.
Please provide sanitized sample data that fully covers your issue.
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216
Please show the expected outcome based on the sample data you provided.
https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523