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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

dividing row total of a column by the subtotal of that column, period wise

i want to divide each row of TY_Actual with its subtotal i.e 110679.54 to get the %. for example if i divide lunch row TY i.e 30001.88 by 110679.54 i will get 27%. now here is the catch, this TY_Actual column has data of 6 months, and the value 30001.88 is the sum of values of 6 months. now if i put a slicer on it for 5th month, my TY_Actual col will be updated with 5th month data and subtotal will change and thus the % calculated will change too. 

i'm currently using this dax query ---- 

TTP by Total % =
var a = sum('Daypart'[TTP_TY_Actual])
var b = calculate ( sum('Daypart'[TTP_TY_Actual]),REMOVEFILTERS('Daypart'))
return
divide(a,b) * 100 
 
Screenshot 2023-11-08 175229.png
3 REPLIES 3
edhans
Super User
Super User

You can restore the months in the filter as shown below with VALUES().

 

TTP by Total % =
VAR a =
    SUM( 'Daypart'[TTP_TY_Actual] )
VAR b =
    CALCULATE(
        SUM( 'Daypart'[TTP_TY_Actual] ),
        REMOVEFILTERS( 'Daypart' ),
        VALUES( DayPart[YearMonth] )
    )
RETURN
    DIVIDE( a, b ) * 100

However, your request isn't 100% clear, so please explain your exact goal.

 

How to get good help fast. Help us help you.

How To Ask A Technical Question If you Really Want An Answer

How to Get Your Question Answered Quickly - Give us a good and concise explanation
How to provide sample data in the Power BI Forum - Provide data in a table format per the link, or share an Excel/CSV file via OneDrive, Dropbox, etc.. Provide expected output using a screenshot of Excel or other image. Do not provide a screenshot of the source data. I cannot paste an image into Power BI tables.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
Anonymous
Not applicable

yes it is working. actually i want to make it more dynamic. i have other columns like TY_1, TY_2 and so on so how can i generalize your formula to make it more dynamic 

 

Replace REMOVEFILTERS() with ALLSELECTED().

That might not do what you want though. You didn't explain what you mean by "Dynamic." Please read the below this time give us enough info to help.


How to get good help fast. Help us help you.

How To Ask A Technical Question If you Really Want An Answer

How to Get Your Question Answered Quickly - Give us a good and concise explanation
How to provide sample data in the Power BI Forum - Provide data in a table format per the link, or share an Excel/CSV file via OneDrive, Dropbox, etc.. Provide expected output using a screenshot of Excel or other image. Do not provide a screenshot of the source data. I cannot paste an image into Power BI tables.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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