Forum Discussion

C-F-G's avatar
C-F-G
Frequent Visitor
1 year ago
Solved

Counting distinct over several columns

Hi all, I have an order table lived connected with a SSAS/Report server.  The table has columns with vehicle IDs (VINs, not distinct), with project name and with order status. Order status can be ...
  • bhanu_gautam's avatar
    1 year ago

    C-F-G , Create a measure to count the distinct VINs where all orders are cancelled within the same project.

    CancelledNoFollowingOrder =
    CALCULATE(
    DISTINCTCOUNT(orders[VIN]),
    orders[status] = "CANCELLED",
    NOT (
    EXISTS (
    FILTER (
    orders,
    orders[status] = "FINISHED" && orders[VIN] = EARLIER(orders[VIN]) && orders[project] = EARLIER(orders[project])
    )
    )
    )
    )