DAX formula help, WoW percent change

GrahamCracker19

New Member
Joined
Nov 4, 2015
Messages
13
Looking for some help with a DAX formula to calculate the WoW percent change. I have the formula below but the card visual doesn't have any value displayed and I cannot figure out my error. Any help is much appreciated.

Power Query:
% Change Sales = 
VAR CurrentValue = SUM('Sales'[Units])
VAR PreviousValue =
SWITCH(
    TRUE(),
    ISINSCOPE('Sales'[Report Date]), CALCULATE((SUM('Sales'[Units])), DATEADD('Sales'[Report Date].[Day], -7, DAY))
)
RETURN
DIVIDE(
    CurrentValue - PreviousValue,
    PreviousValue
)
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
What is the purpose of ISINSCOPE?

When writing time intelligence measures, never ever use a card to test it. Set up a table (or matrix) with time progression on rows. In your case you need either weeks or days on rows. Then add your measure to the table. Doing it this way will show you what your measure is doing. My guess is your measure works but it doesn’t work for the last date in the filter context.
 
Upvote 0
I'm very much a novice with DAX and was researching how to write the code for what I wanted. One of the walk through videos that I found had that in there, I used the code he provided in his video to calculate the value I was looking for.

I will try as a table and let you know the result.
 
Upvote 0
Did you remove "INSCOPE"? I have no idea what you are trying to do with that function.
Also, you would be better using your own calendar table.
 
Upvote 0

Forum statistics

Threads
1,215,200
Messages
6,123,598
Members
449,109
Latest member
Sebas8956

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top