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
elkjoperik
Helper II
Helper II

Issues with a metric vs LY - Infinity

Hi!

I have a data sett where i have a DATE datebase that is based on DATE - dd.MM.yyyy format. 

 

I have DATE filters in the report where i can select; YEAR - MONTH - WEEK - DAY

 

I am trying to to make a "Revenue VS LY" metric where I'm trying to achieve this; powerbi.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

As you can see, it does't work.

 

My formula is;

 

Active filter on page: YEAR = 2017

Formula: CALCULATE(SUM(Revenue)/CALCULATE(SUM(Revenue);'DATE'[YEAR]=2016)

 

I've also tried to remove the page year filter and specify the year in the formula; 

CALCULATE(SUM(Revenue);'DATE'[YEAR]=2017)/CALCULATE(SUM(Revenue);'DATE'[YEAR]=2016)

 

But that creates the same scenario. 

 

I would like to have a running formula where I have the same table as above, and when i select a year, the "revenue vs ly" would change to the filter selected, for example:

 

If i change the page year filter to 2016, the the formula should calculate 2016 vs 2015, based on if I select YEAR - MONTH - WEEK or DAY,

 

How would i achieve this ? Thanks!

1 ACCEPTED SOLUTION
elkjoperik
Helper II
Helper II

Hi,

Thanks for reaching out. 

 

I found a solution yesterday;  https://exceltown.com/en/tutorials/power-bi/powerbi-com-and-power-bi-desktop/dax-query-language-for-...

 

This solved the issue 😄 

View solution in original post

4 REPLIES 4
elkjoperik
Helper II
Helper II

Hi,

Thanks for reaching out. 

 

I found a solution yesterday;  https://exceltown.com/en/tutorials/power-bi/powerbi-com-and-power-bi-desktop/dax-query-language-for-...

 

This solved the issue 😄 

Hi!

I have a data sett where i have a DATE datebase that is based on DATE - dd.MM.yyyy format. 

 

I have DATE filters in the report where i can select; YEAR - MONTH - WEEK - DAY

 

I am trying to to make a "Revenue VS LY" metric where I'm trying to achieve this; powerbi.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

As you can see, it does't work.

 

My formula is;

 

Active filter on page: YEAR = 2017

Formula: CALCULATE(SUM(Revenue)/CALCULATE(SUM(Revenue);'DATE'[YEAR]=2016)

 

I've also tried to remove the page year filter and specify the year in the formula; 

CALCULATE(SUM(Revenue);'DATE'[YEAR]=2017)/CALCULATE(SUM(Revenue);'DATE'[YEAR]=2016)

 

But that creates the same scenario. 

 

I would like to have a running formula where I have the same table as above, and when i select a year, the "revenue vs ly" would change to the filter selected, for example:

 

If i change the page year filter to 2016, the the formula should calculate 2016 vs 2015.

 

How would i achieve this ? Thanks!

v-shex-msft
Community Support
Community Support

Hi @elkjoperik,

 

Share some sample data/pbix file will help us clarify your issue.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Interkoubess
Solution Sage
Solution Sage

Hi @elkjoperik,

 

Please create a calendar table and link it to your data model ( with the date) and then create the following measures:

 

Current Revenue=Sum([Revenue])
Prev Revenue=calculate([Current Revenue], sameperiodlastyear(Calendar(Dates))

Revenue VS LY=divide([Current Revenue], [Prev Revenue],blank())

Please feel free to give any observations if it does not work or you have any remarks...

 

Ninter

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.