Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
JonatanM
Frequent Visitor

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!

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @JonatanM ,

I created some data:

vyangliumsft_0-1673512324205.png

 

 

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:

vyangliumsft_1-1673512324209.png

 

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

View solution in original post

2 REPLIES 2
v-yangliu-msft
Community Support
Community Support

Hi  @JonatanM ,

I created some data:

vyangliumsft_0-1673512324205.png

 

 

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:

vyangliumsft_1-1673512324209.png

 

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

FreemanZ
Super User
Super User

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)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.