cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Prodigy
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
Microsoft

Re: Sameperiod last year measure not working

@Route11,

 

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.

View solution in original post

4 REPLIES 4
Highlighted
Post Prodigy
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
Microsoft

Re: Sameperiod last year measure not working

@Route11,

 

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.

View solution in original post

Highlighted
Post Prodigy
Post Prodigy

Re: Sameperiod last year measure not working

Capture.PNG

 

Hi lydia

 

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

Highlighted
Post Prodigy
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")

 

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

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

Upcoming Events

Experience what’s next for Power BI

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

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors