Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
HI,
maybe simple, but i'm through,
A customer has the choice to order (orderwy) by EDI or FAX.
Now i want to know how many FAX orders are placed after the first time they ordered by EDI (by customer).
FAX orders after EDI implementation =
CALCULATE(
SUM(Orders[Quantity]),
Orders[OrderWay] <> "EDI",
FILTER(
Orders,
Orders[Date] >= CALCULATE(FIRSTDATE(Orders[Date]),Orders[OrderWay] = "EDI")
)
)
hope someone can help me
with kind regards
Solved! Go to Solution.
Hi @Anonymous
Maby someone can come up with less complicated syntax but until then you can try this, also see the attached.
Measure =
VAR __EDIOrders =
CALCULATETABLE(
GROUPBY(
Orders,
Orders[CustomerID],
"@MaxDate", MINX( CURRENTGROUP(), Orders[Date] )
),
ALL( Orders ),
VALUES( Orders[CustomerID] ),
KEEPFILTERS( Orders[OrderWay] = "EDI" )
)
RETURN
SUMX(
__EDIOrders,
VAR __maxDate = [@MaxDate]
RETURN
CALCULATE(
COUNTROWS( Orders ),
KEEPFILTERS( Orders[OrderWay] = "fax" ),
KEEPFILTERS( Orders[Date] > __maxDate )
)
)
Hi @Anonymous
Maby someone can come up with less complicated syntax but until then you can try this, also see the attached.
Measure =
VAR __EDIOrders =
CALCULATETABLE(
GROUPBY(
Orders,
Orders[CustomerID],
"@MaxDate", MINX( CURRENTGROUP(), Orders[Date] )
),
ALL( Orders ),
VALUES( Orders[CustomerID] ),
KEEPFILTERS( Orders[OrderWay] = "EDI" )
)
RETURN
SUMX(
__EDIOrders,
VAR __maxDate = [@MaxDate]
RETURN
CALCULATE(
COUNTROWS( Orders ),
KEEPFILTERS( Orders[OrderWay] = "fax" ),
KEEPFILTERS( Orders[Date] > __maxDate )
)
)
I think this works, please test at your side,
ChilliFAX orders after EDI =
VAR _1stEdi = CALCULATE(FIRSTDATE(Orders[Date]),Orders[OrderWay] = "EDI")
RETURN
IF (_1stEdi <> 0,
CALCULATE(
--replace COUNTROWS with this to get quantity SUM(Orders[Quantity]),
COUNTROWS(
FILTER(Orders,
Orders[OrderWay] <> "EDI" &&
Orders[Date] >= _1stEdi
)
)
)
)
Mariusz, I learn a lot from your posts. Wow, I am going to have to study that one.
Totals bring their own challenges of course.
You could try:
MeasTotals = SUMX(VALUES(Klanten), [ChilliFAX orders after EDI])
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 38 | |
| 36 | |
| 33 | |
| 33 | |
| 29 |
| User | Count |
|---|---|
| 134 | |
| 96 | |
| 78 | |
| 67 | |
| 65 |