Forum Discussion

jpaguiar's avatar
jpaguiar
Frequent Visitor
3 years ago
Solved

Divide Prior to SumX

Hi folks, It might a simple task, but I've tried to create the Aux_Column using several different combinations of Calculate, SumX, Divide, Filter, FirstNonBlank, among others but no lucky. My goa...
  • FreemanZ's avatar
    3 years ago

    hi jpaguiar 

    try like:

    Column =
    VAR _table=
    FILTER(
        TableName,
        TableName[Cycle]=EARLIER(TableName[Cycle])
    )
    VAR _running = 
    SUMX(
        FILTER(
            _table,
            TableName[Driver]="Running"
        )
        TableName[Actual]
    )
    VAR _waiting = 
    SUMX(
        FILTER(
            _table,
            TableName[Driver]="Waiting"
         ),
        TableName[Actual]
    )
    RETURN DIVIDE(_running, _waiting)
     
    it worked like:
  • tamerj1's avatar
    tamerj1
    3 years ago

    jpaguiar 
    Yes you are right. Seems like the context transition effect of the SUMMARIZE function is creating a filter context issue that is not easy to understand. Replacing SUMMARIZE with GROUPBY solves the problem