Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

How to chose axis for the graph

Hello everyone!  I have this data and I would like to see the distibution of the measure. To see in % how much of measure falls into range 0-10, how many 10-20. I was trying to show this on th...
  • v-alq-msft's avatar
    6 years ago

    Hi, Anonymous 

     

    Based on your description, I created some sample data to reproduce your scenario. The pbix file is attached in the end.

     

    I assume that the measure is as below.

    Measure = 
    SWITCH(
        SELECTEDVALUE('Table'[Vesse|Scheduled]),
        67,0,
        445,2,
        469,1,
        578,36,
        1159,8,
        1160,16,
        1161,13,
        1162,15,
        1163,15,
        1164,19,
        1165,12,
        1166,21,
        1167,20,
        1168,21,
        1169,11,
        1170,12,
        1171,19,
        1172,15,
        1173,16,
        1174,14,
        1175,0,
        1176,17,
        1177,3,
        1178,10,
        1179,10,
        1180,8,
        1181,13,
        BLANK()
    )

     

    Table:

     

    Test:

     

    You may create a new measure as below.

    Count = 
    var _start = SELECTEDVALUE(Test[Start])
    var _end = SELECTEDVALUE(Test[End])
    var tab = 
    SUMMARIZE(
        'Table',
        'Table'[Vesse|Scheduled],
        "Value",
        [Measure]
    )
    var newtab = 
    SUMMARIZE(
        Test,
        Test[Range],
        Test[Start],
        Test[End],
        "Count",
        var s = [Start]
        var e = [End]
        var t = 
        ADDCOLUMNS(
            tab,
            "Flag",
            IF(
                [Value]>=s&&[Value]<e,
                1,0
            )
        )
        return
        COUNTROWS(
            FILTER(
                t,
                [Flag] = 1
            )
        )
    )
    return
    SUMX(
        newtab,
        [Count]
    )

     

    Result::

     

    Best Regards

    Allan

     

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