Forum Discussion

JonatanM's avatar
JonatanM
Frequent Visitor
3 years ago
Solved

Add a new visual with a calculated measure

Dear all,

 

I am new to Power BI and these forums and am a bit nervous about asking a silly question here, but please bare with me. I have created a report I am quite happy with, showing among other things how many tickets I have in my data set (an Excel sheet) divided into four age groups (0-10 months, 10-36 months, 36 months-5 years, above 5 years). I did that by adding a calculated column with some IF statements.

 

Now, I would like to add a visual object to my report showing one calculated figure from these numbers: the ratio beween the rest vs. the 0-10 months. Say f.ex. the number of 0-10 months is 40, and the rest aggregate are 60, I would like a visual showing 60/(40+60) = "60%". 

 

I figure since the numbers are there, in the visual report, I would be able to do these calculations as part of a visual object and could stay out of the data and avoid adding another caluclated column. But I am a bit worried I am misunderstanding a lot by suggesting that... either way, any help to solve this or set me straight would be appreciated. Thank you!

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi  JonatanM ,

    I created some data:

     

     

    Here are the steps you can follow:

    1. Create measure.

    Measure =
    var _grouptime=
    COUNTX(FILTER(ALL('Table'),'Table'[Flag]=MAX('Table'[Flag])),[Flag])
    var _Other=
    COUNTX(ALL('Table'),[Flag]) - _grouptime
    return
    DIVIDE(
        _grouptime,_Other)

    2. Result:

     

    Best Regards,

    Liu Yang

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

2 Replies

  • hi JonatanM 

    you can plot a Card Visual with a measure like this:

    Ratio =
    VAR _a =
    CALCULATE(
         SUM(TableName[Ticket])), 
         TableName[AgeGroup] ="0-10Month"
    )
    VAR _b =
    CALCULATE(
         SUM(TableName[Ticket])), 
         ALL(TableName[AgeGroup])
    )
    RETURN
    DIVIDE(_a, _b - _a)
  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  JonatanM ,

    I created some data:

     

     

    Here are the steps you can follow:

    1. Create measure.

    Measure =
    var _grouptime=
    COUNTX(FILTER(ALL('Table'),'Table'[Flag]=MAX('Table'[Flag])),[Flag])
    var _Other=
    COUNTX(ALL('Table'),[Flag]) - _grouptime
    return
    DIVIDE(
        _grouptime,_Other)

    2. Result:

     

    Best Regards,

    Liu Yang

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