Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi all I have a problem to My table
DAX formula that did not worked. There are 4 different columns: - date, id, Art.nr. and sold_item I would like to calculate differences in sold_item for products with same ID between dates (starting from oldest to latest date). I tried in DAX with the calculated column but did not work. Anyone who can give me advice on how to do it?
sorry but I have no idea how to do it in Power Query
// This should be calculated in Power Query.
// I give you a DAX formula but if the table is
// big (and it seems to be a fact table), you
// might wait a very long time for this calculation
// to end. Depending on the size of the table
// you might even get a memory overflow. Then
// you know you have to do it in PQ. Let's say
// your table is T (I don't want to type the full name).
// By the way, using CALCULATE for a row-by-row
// calculation in a fact table will get you in
// trouble in no time.
sales_diff = // calc column
var __artikelNr = T[Artikelnr]
var __firstValue =
SUMX(
// I can use topn(1,...) here because
// all rows with the same dates (ties)
// will be returned. Same goes for the
// other expression.
topn(1,
filter(
T,
T[Artikelnr] = __artikelNr
),
T[Date],
ASC
),
T[Salt antal totalt]
)
var __secondValue =
SUMX(
topn(1,
filter(
T,
T[Artikelnr] = __artikelNr
),
T[Date],
DESC
),
T[Salt antal totalt]
)
return
__firstValue - __secondValue
Hi @DanielPasalic ,
Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)
@DanielPasalic - See my article on Mean Time Between Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/3395...
User | Count |
---|---|
22 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
26 | |
13 | |
11 | |
9 | |
6 |