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
Wresen
Post Patron
Post Patron

"Save" away result to compare with the new run of data

Hi and thanks for reading this.

(and sorry for the bad subject.)

 

My question if it is possible to save the calculted resualt in the report so next time i run the report with new data i have the old result in the report so i can compair the new data result with the old.

 

ex.

Apple.png

 

As you probebly understand i the data i have is much more "complicated" than Apple sales (there is 3 x's in the calculation and the changes every day)

 

/Thanks so much 

1 ACCEPTED SOLUTION

Hi @Wresen ,

 

Are you saying that every update to your dataset will overwrite the previous data? If yes, you can't save the last result dynamically, you can only save the last result in the text box manually.

 

But if every time new data is appended to the original data, you can do like this.

1. Create a calculated column.

_Rank = 
RANKX(
    Sheet1,
    Sheet1[Month],
    , ASC, Dense
) 

2. Create a measure.

Sold of last month = 
VAR x =  
CALCULATE(
    SUM(Sheet1[Sold]),
    FILTER(
        ALL(Sheet1),
        Sheet1[_Rank] = MAX(Sheet1[_Rank]) - 1
    )
)
RETURN
x

kkk1.PNG

 

Best regards,
Lionel Chen

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

4 REPLIES 4
amitchandak
Super User
Super User

@Wresen , Try with date table

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
last MTD (complete) Sales =  CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-1,MONTH))))
last year MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-12,MONTH)))
last year MTD (complete) Sales =  CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-12,MONTH))))
Month behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Month))
last QTR same Month (complete) Sales =  CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-1,Qtr))))
MTD (Year End) Sales =  CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFYEAR('Date'[Date])))
MTD (Last Year End) Sales =  CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFYEAR(dateadd('Date'[Date],-12,MONTH),"8/31")))
	


diff = [MTD Sales]-[last MTD Sales]
diff % = divide([MTD Sales]-[last MTD Sales],[last MTD Sales])

 

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-Y...


Appreciate your Kudos.

Hi @amitchandak 

 

Thanks so much , but i think i have not explained well.

I fell abit bad for that since you made a great post.

 

Apple2.png

 

So what i want is to save away the total number of sold Apples (3) from 201903 so i can compair the sales i made 201904 with 201903.
In the data 201904 i Only see 201904 data , 201903 data is gone , thats why i want to "save" the resulat in the report when i loaded the data 201903.

Hi @Wresen ,

 

Are you saying that every update to your dataset will overwrite the previous data? If yes, you can't save the last result dynamically, you can only save the last result in the text box manually.

 

But if every time new data is appended to the original data, you can do like this.

1. Create a calculated column.

_Rank = 
RANKX(
    Sheet1,
    Sheet1[Month],
    , ASC, Dense
) 

2. Create a measure.

Sold of last month = 
VAR x =  
CALCULATE(
    SUM(Sheet1[Sold]),
    FILTER(
        ALL(Sheet1),
        Sheet1[_Rank] = MAX(Sheet1[_Rank]) - 1
    )
)
RETURN
x

kkk1.PNG

 

Best regards,
Lionel Chen

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

Thanks so much @v-lionel-msft 

 

You answerd my question with:

Are you saying that every update to your dataset will overwrite the previous data? If yes, you can't save the last result dynamically, you can only save the last result in the text box manually.

 

Thanks so much @v-lionel-msft  and @amitchandak  for all the help here.

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.