cancel
Showing results for
Did you mean:
Highlighted
Post Prodigy

## Sameperiod last year measure not working

Hi Experts

I am trying to work out the values for the same period last year, cannot see the wood for the trees as what i am doing wrong..

CALCULATE([TotalAssessments],SAMEPERIODLASTYEAR(DimDate[Month&Year])))

TotalAssessment = Measure 1 + Measure 2

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Microsoft

## Re: Sameperiod last year measure not working

What result would you like to get? Could you please share sample data of your table and post expected result based on sample data here?

If you add the measure to Matrix and it doesn't return correct total value, please create a new measure using DAX below and drag the measure to your Matrix visual. The RowField is the field that you drag to Rows of Matrix visual.

SamePeriodLastYear= CALCULATE([TotalAssessments],FILTER(ALL(DimDate),DimDate[Year]=MAX(DimDate[Year])-1),SAMEPERIODLASTYEAR(DimDate[Date]))
NewMeasure = IF(COUNTROWS(VALUES(Table[RowField]))=1, [SamePeriodLastYear],SUMX(VALUES(Table[RowField]),[SamePeriodLastYear]))

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
4 REPLIES 4
Highlighted
Post Prodigy

## Re: Sameperiod last year measure not working

I have re worked the formula to..

= CALCULATE([TotalAssessments],FILTER(ALL(DimDate),DimDate[Year]=MAX(DimDate[Year])-1),SAMEPERIODLASTYEAR(DimDate[Date]))

but the total is wrong...

Highlighted
Microsoft

## Re: Sameperiod last year measure not working

What result would you like to get? Could you please share sample data of your table and post expected result based on sample data here?

If you add the measure to Matrix and it doesn't return correct total value, please create a new measure using DAX below and drag the measure to your Matrix visual. The RowField is the field that you drag to Rows of Matrix visual.

SamePeriodLastYear= CALCULATE([TotalAssessments],FILTER(ALL(DimDate),DimDate[Year]=MAX(DimDate[Year])-1),SAMEPERIODLASTYEAR(DimDate[Date]))
NewMeasure = IF(COUNTROWS(VALUES(Table[RowField]))=1, [SamePeriodLastYear],SUMX(VALUES(Table[RowField]),[SamePeriodLastYear]))

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Post Prodigy

## Re: Sameperiod last year measure not working

Hi lydia

the total should be the sum of the individual periods as shown above...i.e. 34+21+ etc....

Highlighted
Post Prodigy

## Re: Sameperiod last year measure not working

forgot to mention that

totalassessment is made up of two measures...

1. Remote1Assessment = CALCULATE(COUNTROWS(Table),Table[Field1]="true") and

2. Remote2Assessment = CALCULATE(COUNTROWS(Table),Table[Field2]="true")

Announcements

#### Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

#### Experience what’s next for Power BI

See the latest Power BI innovations, updates, and demos from the Microsoft Business Applications Launch Event.

#### Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021