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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
aditya_fractal
Advocate II
Advocate II

How to implement Time intelligence on custom columns/measures?

Hi all,

 

This might be pretty easy for most of us around here but I'm a newbie to the POWER BI platform. Request your help for the below scenario.

 

I have a date column which is a date hierarchy containing

  • Year
  • Month
  • Quarter

I need to show up, Year, total sale, total previous year sale, etc. I'm able to do this using CALCULATE & SAMEPERIODLASTYEAR function.

 

But the slicer for Year should show values as FY2020, FY2019, FY2018 for which I've to create a new measure which has resulted in the loss of Time intelligence & the functions used above are not working anymore.

 

Please let me know if there is any other way of showing up FY2020, FY2019, etc.. & if this is the only way, how can I handle to show the required matrix?

 

Thanks in advance!

 

5 REPLIES 5
Greg_Deckler
Super User
Super User

A new measure or column? Can you just create a new column in your table, "FY" & [Year] and use that in your slicer?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_DecklerYes, I'm having "FY"&"[Year]" as a column in the table. That's working fine on the slicer but the time intelligence functions do not work anymore.

This FY & year is in date table ?

And you marked it as date table. Also, Make sure slicer is from date table column.

 

Totalytd or datesytd should work

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(('Date'[Date]),"12/31"))
This Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD((ENDOFYEAR('Date'[Date])),"12/31"))

Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
Last YTD complete Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
Last to last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))

That's weird. Can you post sample data and formulas? Also, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler @amitchandak 

I apologize for the delayed response. Please allow me to describe the situation as below.

The data is in the below format:

 

DateSalesLabel
YearFY Year
2020-01-013A2020FY 2020
2020-02-014A2020FY 2020
2020-01-013B2020FY 2020
2020-02-014B2020FY 2020
2019-03-015A2019FY 2019
2019-02-011A2019FY 2019
2018-02-013A2018FY 2018
2018-04-012A2018FY 2018
2019-03-015B2019FY 2019
2019-02-011B2019FY 2019
2018-02-013B2018FY 2018
2018-04-012B2018FY 2018

 

The 'FY Year' is a custom column. Now, I want a slicer on 'FY Year' & a table showing current year sales & previous year sales. But when I use 'Year' on the slicer, everything works fine but If I use 'FY Year' on a slicer, previous year sales column turn blank. The required table if the 'FY Year' is selected as 2019 can be seen below:

LabelThis Year SalesPrevious Year Sales
A65
B65

The formulas used to create the measures are:

  • This Year Sales = SUM(Sales)
  • Previous Year Sales = CALCULATE(SUM(Sales), SAMEPERIODLASTYEAR(Date))

 

Please assist on how we can handle this.

 

Thank you!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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