cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Regular Visitor

## Percentage from a calculated measure if less than

Can anyone help please as  I am new to PowerBI.  I have tried many times to create a measure that will give me a percentage if my calculated measure below shows the time to admission from referral is less than 3 days.  I would like to show the visual as a percentage on a card.  My filter for dates will be within the last 7 days.

The column dax is

Thank you!

2 ACCEPTED SOLUTIONS
Solution Supplier

Not a great deal to go on here, but assuming you want a % that fall within 3 days you can use the DAX below:

``````% within 3 days =

VAR _count = COUNTROWS( 'Table' )
VAR _count_in_3days = COUNTROWS(CALCULATETABLE( 'Table', 'Table'[days] <= 3))
VAR calc = DIVIDE( _count_in_3days, _count, 0 )
RETURN
calc``````

Here I am using CALCULATETABLE to create a virtual table in the measure which stores only the rows where the days are less than or equal to 3. (you can change this filter as required).

If you've not used them before VAR creates varaibles that store elements of your calculation for referencing back to later.

A screenshot of this output is below:

Community Support

Thanks for the reply from @mark_endicott , please allow me to provide another insight
Hi  @GTaylor1959 ,

I created some data:

Column table:

Here are the steps you can follow：

1. Create calculated column.

``````Column_dax =
DAY)``````

2. Create measure.

``````Measure =
var _count3=
COUNTX(
var _allcount=
COUNTX(
return
DIVIDE(
_count3,_allcount)``````

3. 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 2
Community Support

Thanks for the reply from @mark_endicott , please allow me to provide another insight
Hi  @GTaylor1959 ,

I created some data:

Column table:

Here are the steps you can follow：

1. Create calculated column.

``````Column_dax =
DAY)``````

2. Create measure.

``````Measure =
var _count3=
COUNTX(
var _allcount=
COUNTX(
return
DIVIDE(
_count3,_allcount)``````

3. 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

Solution Supplier

Not a great deal to go on here, but assuming you want a % that fall within 3 days you can use the DAX below:

``````% within 3 days =

VAR _count = COUNTROWS( 'Table' )
VAR _count_in_3days = COUNTROWS(CALCULATETABLE( 'Table', 'Table'[days] <= 3))
VAR calc = DIVIDE( _count_in_3days, _count, 0 )
RETURN
calc``````

Here I am using CALCULATETABLE to create a virtual table in the measure which stores only the rows where the days are less than or equal to 3. (you can change this filter as required).

If you've not used them before VAR creates varaibles that store elements of your calculation for referencing back to later.

A screenshot of this output is below:

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - June 2024

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

#### Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors
Top Kudoed Authors