cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RKCD
New Member

Blank values for LY measure

I'm attempting to populate the "Units LY" field in the table below:

 

RKCD_1-1642447279665.png

 

As you can see, I've successfully added my "Units" measure (directly from my source).  The "Month" column is from my Date table and directly references the id column from that table.  The Units YoY% measure returns accurate results and is calculated as: 

 

Units YoY% =
VAR __PREV_YEAR = CALCULATE(SUM('Next Gen Data V3'[Units]), DATEADD('Date'[Month], -1, YEAR))
RETURN
    DIVIDE(SUM('Next Gen Data V3'[Units]) - __PREV_YEAR, __PREV_YEAR)

 

I wanted to include a "Units LY" measure to show the previous year's units for each month, so I added a new measure:

 

Units LY =
CALCULATE(
SUM('Next Gen Data V3'[Units]),
DATEADD('Date'[Month], -1, YEAR)
)

 

However, when I include this new "Units LY" measure in my table, you can see the values are blank. 

 

What's interesting is that my formula for "Units LY" is the exact same formula used to calculate "_PREV_YEAR" in my YoY% formula - where it appears to work correctly within the broader calculation.  So I'm really confused why the underlying "Units LY" calculation wouldn't work as-is. 

 

I've tried re-working the formula using SAMEPERIODLASTYEAR() but the results are the same.  As you can see in the table, I also broke out the DATEADD() function as a separate measure to make sure it was actually recognizing the date from one year earlier - and you can see it works just fine.  

 

Any idea why my "Units LY" measure isnt' returning values?  

 

The dataset is large but I can provide more detail if necessary - thank you!

 

EDIT - for reference - this is my date table:

 

RKCD_0-1642447818367.png

 

And my data structure:

 

RKCD_0-1642447901647.png

 

 

 

 

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@RKCD looks like you are adding UNITS LY as a column, not a measure, it should be  measure.

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

 

Learn about conditional formatting at Microsoft Reactor

My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.






Did I answer your question? Mark my post as a solution.

Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.





View solution in original post

6 REPLIES 6
parry2k
Super User
Super User

@RKCD not it is not, the measure will look like a calculator.

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

 

Learn about conditional formatting at Microsoft Reactor

My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.






Did I answer your question? Mark my post as a solution.

Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.





parry2k
Super User
Super User

@RKCD based on what I see in the menu (column tootls) it is not a measure. try again, make sure to add a measure not a column and that's the only reason why it is not working.

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

 

Learn about conditional formatting at Microsoft Reactor

My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.






Did I answer your question? Mark my post as a solution.

Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.





@parry2k - nevermind - I figured it out based on your comment.  Simple fix but it was frustrating me all afternoon - thanks for your help!

Thanks @parry2k. Here it is in the Fields list - based on the icon I believe it already is a measure?

 

RKCD_0-1642454430217.png

 

RKCD
New Member

Thank you for the reply @parry2k 

 

I click "New measure" and input the following:

 

RKCD_0-1642453144434.png

 

Is there something I should be doing differently to create it as a measure?  

 

(Sorry if I'm missing something obvious - just started teaching myself)

parry2k
Super User
Super User

@RKCD looks like you are adding UNITS LY as a column, not a measure, it should be  measure.

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

 

Learn about conditional formatting at Microsoft Reactor

My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.






Did I answer your question? Mark my post as a solution.

Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.





Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors
Top Kudoed Authors