cancel
Showing results for
Did you mean:

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a \$100 discount. Register Now

Responsive Resident

## Table visualisation with percentage of row above

Hi,

I need to create the logic of the Funnel Chart on the table,
to show category, value an %, in a way that the first row is 100% and others are the percentage of the row above like on the picture I attached. is there is a way to make it happen dynamically?

1 ACCEPTED SOLUTION
Community Support

Hi @Ritaf ,

I updated your sample pbix file(see attachment), please check whether that is what you want.

1. Create a calculated column as below to get the rank base on the sum of values group by category

``````Rank =
RANKX (
ALLSELECTED ( 'Sheet1'[Category] ),
CALCULATE ( [test], ALLEXCEPT ( 'Sheet1', 'Sheet1'[Category] ) )
)``````

2. Create a measure as below to get the percentage

``````% =
VAR _selcat =
SELECTEDVALUE ( 'Sheet1'[Category] )
VAR _selindex =
SELECTEDVALUE ( 'Sheet1'[Rank] )
VAR _prerank =
CALCULATE (
MAX ( 'Sheet1'[Rank] ),
FILTER ( ALLSELECTED ( 'Sheet1' ), 'Sheet1'[Rank] < _selindex )
)
VAR _pretest =
SUMX ( FILTER ( ALLSELECTED ( 'Sheet1' ), 'Sheet1'[Rank] = _prerank ), [test] )
RETURN
IF ( _selindex = 1, 1, DIVIDE ( [test], _pretest ) )``````

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 REPLIES 3
Super User

Power BI has no concept of "Row Above" - you need to help it by providing indexes, or by hard coding the logic (for example "Sales as percentage of Calls".

If you paste the sample data into a table in your post or use one of the file services it will be easier to work with.

Responsive Resident

Hi,
Thank you for your response I know that Power BI has no concept of "Row Above", not in visualization at less, and have no doubt that this isn't standard logic.
I hope somebody has an idea how to solve it dynamically without measure for each category and "Switch" games.

Community Support

Hi @Ritaf ,

I updated your sample pbix file(see attachment), please check whether that is what you want.

1. Create a calculated column as below to get the rank base on the sum of values group by category

``````Rank =
RANKX (
ALLSELECTED ( 'Sheet1'[Category] ),
CALCULATE ( [test], ALLEXCEPT ( 'Sheet1', 'Sheet1'[Category] ) )
)``````

2. Create a measure as below to get the percentage

``````% =
VAR _selcat =
SELECTEDVALUE ( 'Sheet1'[Category] )
VAR _selindex =
SELECTEDVALUE ( 'Sheet1'[Rank] )
VAR _prerank =
CALCULATE (
MAX ( 'Sheet1'[Rank] ),
FILTER ( ALLSELECTED ( 'Sheet1' ), 'Sheet1'[Rank] < _selindex )
)
VAR _pretest =
SUMX ( FILTER ( ALLSELECTED ( 'Sheet1' ), 'Sheet1'[Rank] = _prerank ), [test] )
RETURN
IF ( _selindex = 1, 1, DIVIDE ( [test], _pretest ) )``````

Best Regards

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

Announcements

#### Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

#### Power BI Monthly Update - February 2024

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

#### Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

#### Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors
Top Kudoed Authors