Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. 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.
Hi @Anonymous
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
Hi @Anonymous
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.
User | Count |
---|---|
16 | |
14 | |
13 | |
12 | |
11 |
User | Count |
---|---|
19 | |
16 | |
15 | |
11 | |
9 |