Forum Discussion

gokcen's avatar
gokcen
Regular Visitor
3 years ago
Solved

Qlik sense Expression to dax(urgent)

I don't have any experience and I'm stuck on converting this Qlik Expression to the DAX formula. Can someone help me, please?

if(GetSelectedCount(MonthYear)=0 and GetSelectedCount(Week)=0 and GetSelectedCount(WeekEndDate)=0,
v_Total_Routes = 'count({$<Div_Routes={1},Fact_Type = {"Routes"},DOC_STATUS = , Document_Type=, Document_Nbr=>}distinct Route_Nbr)';

v_Cur_Total_Routes = 'count({$<Div_Routes={1},CurWeekFlag = {"1"},Fact_Type = {"Routes"},DOC_STATUS = , Document_Type=, Document_Nbr=>}distinct Route_Nbr)';

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    HI gokcen,

    It seems like common count calculations with filter conditions, you can try to use following formula if it suitable for your requirements:

    formual =
    VAR v_Total_Routes =
        CALCULATE (
            COUNT ( Table[Div_Routes] ),
            Table[Fact_Type] = "Routes",
            Table[Document_Nbr] >= DISTINCTCOUNT ( Table[ Route_Nbr] )
        )
    VAR v_Cur_Total_Routes =
        CALCULATE (
            COUNT ( Table[Div_Routes] ),
            Table[Fact_Type] = "Routes",
            Table[CurWeekFlag] = "1",
            Table[Document_Nbr] >= DISTINCTCOUNT ( Table[ Route_Nbr] )
        )
    RETURN
        IF (
            ISFILTERED ( Table[MonthYear] ) = FALSE ()
                && ISFILTERED ( Table[Week] ) = FALSE ()
                && ISFILTERED ( Table[WeekEndDate] ) = FALSE (),
            v_Total_Routes,
            v_Cur_Total_Routes
        )

    Regards,

    Xiaoxin Sheng

    • gokcen's avatar
      gokcen
      Regular Visitor

      Thank you so much for your help