Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Measure to display the same period last year

Hi,

 

I need to calculate the total number of jobs from last year against this year, but only up to today. This runs from a Financial year Nov - Oct, so i need to display the figures for FY 2019 Nov - (TODAY) instead of the full year.

 

I have managed the follwing - however, whilst it shows the correct values (highlighted), it shows other values too which arent needed. As I won't actually be using this in a table i need to make sure it only shows the values for the same period. Any ideas what i cam doing wrong?

 
SamePeriodLastYear = CALCULATE(DISTINCTCOUNT(FactShipment[ShipmentID]),SAMEPERIODLASTYEAR(DateDim[MasterDate]))
 
Capture2.PNG
 
Not sure if it helps but this is my Date Table, the Masterdate is filtered by the Fiscal Year.
 
Capture.PNG
 
1 REPLY 1
ibarrau
Super User
Super User

Hi, you can try creating a condition that set as BLANK() the result if the date is after today. Like this:

Medida = 
IF (
    MAX(Table[DateColumn]) < NOW(),
    CALCULATE (
        DISTINCTCOUNT(FactShipment[ShipmentID]),
        SAMEPERIODLASTYEAR(DateDim[MasterDate])
    ),
    Blank()
)

That will work for the table for sure. If the requirement is another visualization, let us know what you need to build.

 

Regards, 


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Happy to help!

LaDataWeb Blog

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.