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
VisheshVats
Helper I
Helper I

Plot sale variance over a month

Hello ,

I wish to plot the variance of current NAV-CHEASH to it's value 30 days back on a line chart. 

for instance if today is 5/9/2022, i wish to find the % difference from 6/8/2022 and plot it on a line chart. so that if i hover over the visual i can get the variance of that particular date. ie, if i hover over 1/9/2022 then i get the % difference from 6/8/2022.

 

Capture.PNG

 

Capture1.PNG

1 ACCEPTED SOLUTION
v-yadongf-msft
Community Support
Community Support

Hi @VisheshVats ,

Please try following DAX to create a new column:

Column = 
var _a = CALCULATE(SUM('Table'[NAV-CHAESH]),FILTER('Table','Table'[Date] = EARLIER('Table'[Date])))
var _b = CALCULATE(SUM('Table'[NAV-CHAESH]),FILTER('Table','Table'[Date] = MAX('Table'[Date])-31))
return
DIVIDE(_a,_b)-1

vyadongfmsft_0-1662973475504.png

 

Please note: If you want it to go to 5/8/2022, MAX[Date] should minus 31.

 

Best regards,

Yadong Fang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-yadongf-msft
Community Support
Community Support

Hi @VisheshVats ,

Please try following DAX to create a new column:

Column = 
var _a = CALCULATE(SUM('Table'[NAV-CHAESH]),FILTER('Table','Table'[Date] = EARLIER('Table'[Date])))
var _b = CALCULATE(SUM('Table'[NAV-CHAESH]),FILTER('Table','Table'[Date] = MAX('Table'[Date])-31))
return
DIVIDE(_a,_b)-1

vyadongfmsft_0-1662973475504.png

 

Please note: If you want it to go to 5/8/2022, MAX[Date] should minus 31.

 

Best regards,

Yadong Fang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-yadongf-msft
Community Support
Community Support

Hi @VisheshVats ,

 

Sorry for the inconsistency in your description, your description is really confusing:

 

if today is 5/9/2022, i wish to find the % difference from 6/8/2022.

if i hover over 1/9/2022 then i get the % difference from 6/8/2022.

If i hover on 1/09/2022 it goes back to 1/8/2022 when i want it to go to 5/8/2022.

 

How many days ago do you want to get the value?

 

Thanks for your efforts & time in advance.

 

Best regards,

Yadong Fang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

VisheshVats
Helper I
Helper I

my measure makes the -30 go back 30 days from the date selected. As in, If i hover on 1/09/2022 it goes back to 1/8/2022 when i want it to go to 5/8/2022,when the first date in the column is 5/8/2022.

I wish to fix the denominator value as -30 days from MAX [date].

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.