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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
kev_sav
Frequent Visitor

SAMEPERIODLASTYEAR based on text column

Hi,

 

I would like to compute SAMEPERIODLASTYEAR() to understand YoY growth of my revenue numbers. However, my data model doesn't have a date column but it has a fiscal_quarter column which is of "Text" data type. Since SAMEPERIODLASTYEAR() requires a date column as an input how do I go about it?

 

I tried adding a column in my data "quarter_start_date" (a date data type) which corresponds to each fiscal_quarter value and compute SAMEPERIODLASTYEAR() based on quarter_start_date, but when i use fiscal_quarter column in the slicer to fiter our the quarter it doen't give me the last year data. Please let me know. Thanks.

 

kev_sav_0-1682502836748.png

 

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

hi @kev_sav 

not sure if i fully get you, please try plot a visual with a measure like:

Measure = 
VAR MaxDate = 
    MAX(data[fiscal_quarter_date])
RETURN
    CALCULATE(
        SUM(data[revenue]),
        data[fiscal_quarter_date]=EDATE(MaxDate, -12),
        ALL(data)
    )

tried to verify with expanded data like:

FreemanZ_0-1682578254468.png

it worked like:

FreemanZ_1-1682578296797.png

FreemanZ_2-1682578323648.png

View solution in original post

2 REPLIES 2
FreemanZ
Super User
Super User

hi @kev_sav 

not sure if i fully get you, please try plot a visual with a measure like:

Measure = 
VAR MaxDate = 
    MAX(data[fiscal_quarter_date])
RETURN
    CALCULATE(
        SUM(data[revenue]),
        data[fiscal_quarter_date]=EDATE(MaxDate, -12),
        ALL(data)
    )

tried to verify with expanded data like:

FreemanZ_0-1682578254468.png

it worked like:

FreemanZ_1-1682578296797.png

FreemanZ_2-1682578323648.png

Thanks a lot. This solution worked!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.