Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
Hi - I'm completely new to Power BI and DAX formulas. I've searched online for solutions to this issue but cannot get it to work. The solution may be really simple but I might have overcomplicated things.
I have a lot of tables but for simplicity sake, my dataset is setup like this:
Here is an example of what a piece of the calendar table looks like:
I'm try to sum [Sales_Amt] from the sales table for LY_DATE. In the below screenshot, I have my TY(WE_DATE) and its corresponding LY_WE_DATE. The sales table is by day. I'm able to aggregate the Net_Sales_Amt using the WE_DATE. But I can't seem to figure out how to sum the corresponding Net_Sales_Amt using the LY_WE_DATE.
I need to keep it in this format because I'm filtering on a relative date to show the last 30 days only for this report vs create a new table.
So as an example, Let's take WE Date 2021-02-07
I now want to sum all the values in the LY dates and have it appear as another column called LY_NET_SALES_AMT
How do I calculate a measure for the LY dates based on values from the calendar table?
Sorry if this sounds confusing! I hope this makes sense to someone!
Solved! Go to Solution.
Hi @Anonymous,
Try this measure:
LY Net Sales Amount =
VAR vLYDate =
MAX ( Dates[LY_WE_DATE] )
VAR vResult =
CALCULATE ( SUM ( Sales[Sales_Amt] ), ALL ( Dates ), Dates[WE_DATE] = vLYDate )
RETURN
vResult
Proud to be a Super User!
Hi @Anonymous,
Try this measure:
LY Net Sales Amount =
VAR vLYDate =
MAX ( Dates[LY_WE_DATE] )
VAR vResult =
CALCULATE ( SUM ( Sales[Sales_Amt] ), ALL ( Dates ), Dates[WE_DATE] = vLYDate )
RETURN
vResult
Proud to be a Super User!
@DataInsights Wow - that worked! I definitely would not have figured this one out. Thank you for your help!
Great! The key is clearing the date filter context with "ALL ( Dates )" so you can filter WE_DATE.
Proud to be a Super User!