Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Grouping continuous measure into groups in DirectQuery

Hi,

 

I have the following below which I want to make group based on % so:
What I have:



What I'm looking for:

 

NOTE: This has to be implemented in a DirectQuery context!

 

I hope someone can help 🙂

  • Hi Anonymous 

    I'll test it later under DQ mode, before that, do you have dimension table containing groups?

    If not, you need to use switch() to get the expected outcome.

    -

    Update:

    create the measure below

    group = 
    var _value=[Measure]
    return SWITCH(TRUE(),
    _value>0&&_value<=0.25,"0 % - 25 %",
    _value>0.25 && _value<=0.5,"25 % - 50 %")

     

    Best Regards,

    Community Support Team _Tang

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

8 Replies

  • v-xiaotang's avatar
    v-xiaotang
    Community Support

    Hi Anonymous 

    Could you please provide some sample data?

    usually information below is needed

     (1) a sample file, you can replace raw data with bogus data to protect your privacy.

         or provide some sample data that fully covers your issue/question.

    (2) give your expected result and its math formula based on the sample you provide.

     

    Best Regards,

    Community Support Team _Tang

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

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Xiaotang,

       

      I cannot provide data as it is running in DirectQuery.

      But it is more of a conceptual question: Is it possible to group/segment values in DirectQuery?

      For instance if a value in a measure is between 0 and 0,25 then the group should be '0 % - 25 %' and if the value is between 0,25 and 0,5 it should be grouped into '25 % - 50 %'. I've tried to create an example below.

      ValueGroup
      0,100 % - 25 %
      0,150 % - 25 %
      0,210 % - 25 %
      0,2625 % - 50 %
      0,3725 % - 50 %
      • v-xiaotang's avatar
        v-xiaotang
        Community Support

        Hi Anonymous 

        I'll test it later under DQ mode, before that, do you have dimension table containing groups?

        If not, you need to use switch() to get the expected outcome.

        -

        Update:

        create the measure below

        group = 
        var _value=[Measure]
        return SWITCH(TRUE(),
        _value>0&&_value<=0.25,"0 % - 25 %",
        _value>0.25 && _value<=0.5,"25 % - 50 %")

         

        Best Regards,

        Community Support Team _Tang

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