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

New Member

Doing percentage based on matrix row total and grouping row under it

Hi I have the below problem, what I want to do is a measure that will update with slicer year/month being select by user an caluate the percentage each grouping is based on the month grand total. So in January there was a total of 140 and 80 in group 1 is 57% of that.

Thanks

 January Group 1 80 57% Group 2 10 7% Group 3 50 36% February Group 1 20 22% Group 2 10 11% Group 3 60 67% March Group 1 20 20% Group 2 30 30% Group 3 50 50%
1 ACCEPTED SOLUTION
Community Support

Hi @Shell64 ,

You can create a measure as below to get it:

``````Measure =
VAR _year =
SELECTEDVALUE ( 'Yourtable'[Date].[Year] )
VAR _monthno =
SELECTEDVALUE ( 'Yourtable'[Date].[MonthNo] )
VAR _per =
SUM ( 'Yourtable'[Value] )
VAR _group =
CALCULATE (
SUM ( 'Yourtable'[Value] ),
FILTER (
ALLSELECTED ( 'Yourtable' ),
YEAR ( 'Yourtable'[Date] ) = _year
&& MONTH ( 'Yourtable'[Date] ) = _monthno
)
)
RETURN
DIVIDE ( _per, _group )``````

If the above one can't help you get the expected result, please provide some raw data in your table (exclude sensitive data) with Text format and the relationship info between the tables. It would be helpful to find out the solution. You can refer the following link to share the required info:

How to provide sample data in the Power BI Forum

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

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

Hi @Shell64 ,

You can create a measure as below to get it:

``````Measure =
VAR _year =
SELECTEDVALUE ( 'Yourtable'[Date].[Year] )
VAR _monthno =
SELECTEDVALUE ( 'Yourtable'[Date].[MonthNo] )
VAR _per =
SUM ( 'Yourtable'[Value] )
VAR _group =
CALCULATE (
SUM ( 'Yourtable'[Value] ),
FILTER (
ALLSELECTED ( 'Yourtable' ),
YEAR ( 'Yourtable'[Date] ) = _year
&& MONTH ( 'Yourtable'[Date] ) = _monthno
)
)
RETURN
DIVIDE ( _per, _group )``````

If the above one can't help you get the expected result, please provide some raw data in your table (exclude sensitive data) with Text format and the relationship info between the tables. It would be helpful to find out the solution. You can refer the following link to share the required info:

How to provide sample data in the Power BI Forum

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

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.
Super User

Read about REMOVEFILTERS.  Identify the total for each month by removing the group filter, and then divide the current value by that.

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