Forum Discussion

xiumi_hou's avatar
xiumi_hou
Icon for Post Partisan rankPost Partisan
6 years ago
Solved

Need help for dax dunction to count filter

Dear all,

 

I have a dax function like below. And I have a sclier to filter each person.

 

1st outreach outbound =
VAR BaseLineBaseDate = MIN(Calls[date_start])
VAR BaseLineBaseValue = CALCULATE( SELECTEDVALUE(Calls[Calls_cstm.channel_c]),FILTER(Calls,Calls[date_start]=BaseLineBaseDate && Calls[direction]="Outbound" ))
return BaseLineBaseValue
 
The problem is, most of the people, it can give the result, there are some gave blank result but it does exist. Is there anything wrong with my dax function? I want to filter out is first outreach type... So I am finding the first outreach date and then look for the corresponding value.
 
Thanks!
  • Anonymous's avatar
    Anonymous
    6 years ago

    HI xiumi_hou ,

    I  think it should more be related to selectedvalue function, it will return blank when it returns multiple results, you can try to follow measure formula if it works: 

    1st outreach outbound =
    VAR BaseLineBaseDate =
        MIN ( Calls[date_start] )
    RETURN
        CALCULATE (
            SELECTEDVALUE (
                Calls[Calls_cstm.channel_c],
                CONCATENATEX (
                    VALUES ( Calls[Calls_cstm.channel_c] ),
                    [Calls_cstm.channel_c],
                    ","
                )
            ),
            FILTER (
                Calls,
                Calls[date_start] = BaseLineBaseDate
                    && Calls[direction] = "Outbound"
            )
        )
    

    Regards,

    Xiaoxin Sheng

7 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    HI xiumi_hou ,

    I  think it should more be related to selectedvalue function, it will return blank when it returns multiple results, you can try to follow measure formula if it works: 

    1st outreach outbound =
    VAR BaseLineBaseDate =
        MIN ( Calls[date_start] )
    RETURN
        CALCULATE (
            SELECTEDVALUE (
                Calls[Calls_cstm.channel_c],
                CONCATENATEX (
                    VALUES ( Calls[Calls_cstm.channel_c] ),
                    [Calls_cstm.channel_c],
                    ","
                )
            ),
            FILTER (
                Calls,
                Calls[date_start] = BaseLineBaseDate
                    && Calls[direction] = "Outbound"
            )
        )
    

    Regards,

    Xiaoxin Sheng

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi

       

      I wonder if your issue is related to the "blank" record created by Power BI when you are relating two tables and the one or many values for the relevant field is not found on one of the tables.

      example

      table 1

      Name_numberName
      1paul
      2john
      3Juan
      4Tomas
      5Ivan

       

      table 2

      Product CountName_number
      101
      23
      610
      68

       

      Final report

      Product countName
      10paul
      2Juan
      12blank

       

      Is this your issue?

       

      Thank you

      Tomas

       

      • xiumi_hou's avatar
        xiumi_hou
        Icon for Post Partisan rankPost Partisan

        Anonymous  Thanks for answering. Yes, I do can not found some records. But the records do exit in my database...