cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
AnetaK Member
Member

LY YTD complicated version

Hi,

 

I would like to have two card visuals. First - Revenue CY, second - revenue LY YTD. I have also a year slicer.

 

If I filter on year 2018 they should show CY: Jan/1/2018 - March/3/2018, LY: Jan/1/2017 - March/3/2017.

BUT... if I filter on 2017 (or earlier) cards should show whole year, CY: Jan/1/2017 - Dec/31/2017, LY: Jan/1/2016 - Dec/31/2016.

 

I also want to show this data in a table (revenue by product and year/month).

 

Do you have any idea what to do?

 

 

 

3 REPLIES 3

Re: LY YTD complicated version

Hi @AnetaK ,

 

Use  TOTALYTD for First - Revenut CY

Use PREVIOUSYEAR for Second - revenut LY YTD

 

Bellow is syntax , Use Values(Your Year Column) to get selected value from slicer


=TOTALYTD(SUM(InternetSales_USD[SalesAmount_USD]),DateTime[DateKey], ALL(‘DateTime’), “6/30”)

=CALCULATE(SUM(InternetSales_USD[SalesAmount_USD]), PREVIOUSYEAR('DateTime'[DateKey]))

AnetaK Member
Member

Re: LY YTD complicated version

It doesn't work 😞

The LY measure shows value for whole 2017 not just two months.

Should I use Calendar[Date] column in the syntax?

 

Revenue LY = CALCULATE(SUM(PowerBI[Revenue]); PREVIOUSYEAR('Calendar'[Date]))

Community Support Team
Community Support Team

Re: LY YTD complicated version

Hi @AnetaK,

 

If you can please share some sample data/pbix file for test.
It is hard to direct code dax formula based on your description without any detail information.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, please consider Accept it as the solution to help the other members find it more quickly
Learning resources: Power BI

Helpful resources

Announcements
Exclusive LIVE Community Event #3 – Ask Arun Anything

Exclusive LIVE Community Event #3 – Ask Arun Anything

Join us in the third Triple A event!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

January 2020 Community Highlights

January 2020 Community Highlights

Make sure you didn't miss any of the things that happened in the community in January!

Top Solution Authors
Top Kudoed Authors