Forum Discussion

Giada_Togliatti's avatar
Giada_Togliatti
Icon for Post Patron rankPost Patron
6 years ago
Solved

Transform qlik set analysis in dax language

Hi,

I need to trasform qlik set analysis in dax language. Set analysis is offers a way of defining a set (or group) of data values that is different from the normal set defined by the current selections.

The original formula is something like this:

count( {<[Field1={'P'},
[field2]={">9"}>} distinct [field3]) 

Should I use calculate?

  • V-lianl-msft's avatar
    V-lianl-msft
    6 years ago

    Hi Giada_Togliatti ,

     

    Try this:

    Measure = CALCULATE(DISTINCTCOUNT('Table'[field3]),FILTER('Table','Table'[field2]>1&&'Table'[field1]="p"))

     

    Best Regards,
    Liang
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

4 Replies

    • Giada_Togliatti's avatar
      Giada_Togliatti
      Icon for Post Patron rankPost Patron

      parry2k I need to define a set (or group) of data values that is different from the normal set defined by the current selections and I should have as an output the result of a measure

      field1field2
      p1
      q2

       

      If field1 is p and field2 is >1 then calculate  count of something called field3

      • V-lianl-msft's avatar
        V-lianl-msft
        Icon for Community Support rankCommunity Support

        Hi Giada_Togliatti ,

         

        Try this:

        Measure = CALCULATE(DISTINCTCOUNT('Table'[field3]),FILTER('Table','Table'[field2]>1&&'Table'[field1]="p"))

         

        Best Regards,
        Liang
        If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • ESANR's avatar
    ESANR
    Regular Visitor

    Hi all, 
    I have the same question but a bit complex. If someone can help me please how to implement the same in POWER BI: 

    Outgoing Products =
    count( distinct
    {<ImportID={$(v_Sequence_B)},
    ProductID=P({ < ImportID={$(v_Sequence_B)}>}ProductID)>
    *
    < ProductID=P({< ImportID={$(v_Sequence_A)}>}ProductID)>} ProductID
    )

    I have also 2 filter objects in QlikView, Where v_sequence_A equals to the selected value of the first filtered object and v_sequence_B equals to the selected value of the second filtered object.
    So, at the first part the query (ProductID=P({ < ImportID={$(v_Sequence_B)}>}ProductID)) must give me all ProductID that are equal to v_sequence_B  and at the second part (ProductID=P({< ImportID={$(v_Sequence_A)}>}ProductID)) will give me all ProductID that are equal to v_sequence_A  and finally  (>*<) it will count me all ImportIDs that are in common respecting both situations. 

    The difficult part of this query is that in power bi (at least as i know) is not possible to retrive the value selected by the filteres in oreder to use it as in another query.
    Is there a way to get common values for a specific period by not considering the value selected from the filter objects? 
    Thans, 
    EHSAN