Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi
I have the following query table yet (i'm not interested in a Table or Matrix visual):
How can i get a new column with the relative difference of one of the visible day with the previous visible day?
Thanks for your help
Solved! Go to Solution.
You can use the OFFSET function.
Here is an example:
Test =
VAR SummarizedTable =
SUMMARIZE (
'Table Principale',
[Date Commande],
"Somme Cash-Flow", SUM ( 'Table Principale'[Prix total avec rabais] )
)
VAR AddPrevious =
ADDCOLUMNS (
SummarizedTable,
"Somme Cash-Flow Previous",
-- Guaranteed to be a single row
SELECTCOLUMNS (
OFFSET ( -1, SummarizedTable, ORDERBY ( 'Table Principale'[Date Commande] ) ),
[Somme Cash-Flow]
)
)
RETURN
AddPrevious
I would also recommend changing SUMMARIZE (...) to ADDCOLUMNS ( SUMMARIZE (... ), ... ), but that's a best practice suggestion rather than a necessity here.
Regards
You can use the OFFSET function.
Here is an example:
Test =
VAR SummarizedTable =
SUMMARIZE (
'Table Principale',
[Date Commande],
"Somme Cash-Flow", SUM ( 'Table Principale'[Prix total avec rabais] )
)
VAR AddPrevious =
ADDCOLUMNS (
SummarizedTable,
"Somme Cash-Flow Previous",
-- Guaranteed to be a single row
SELECTCOLUMNS (
OFFSET ( -1, SummarizedTable, ORDERBY ( 'Table Principale'[Date Commande] ) ),
[Somme Cash-Flow]
)
)
RETURN
AddPrevious
I would also recommend changing SUMMARIZE (...) to ADDCOLUMNS ( SUMMARIZE (... ), ... ), but that's a best practice suggestion rather than a necessity here.
Regards
Thanks a lot! That works like a charm.
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
23 | |
21 | |
19 | |
13 | |
12 |
User | Count |
---|---|
41 | |
31 | |
25 | |
23 | |
23 |