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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Percentages of column total

Good morning,


I have been struggling for some time with displaying percentages relative to the column total (the month), but only get the percentages displayed of the total (the year). I've searched a lot on the internet but I really can't figure it out. Hopefully you can help me further.

 

I want to translate this table into percentages where each month is 100%:

Steen92_3-1606467776811.png

 

I have used different formulas, but the filters from the date table that are selected in the report (month and year) will continue to relate to the output. For now I use the following formula:


% Hour type =
VAR X =
SUM(Hours[Hours])
VAR Y =
SUMX(
ALLSELECTED(Hours),
Hours[Hours])
RETURN
DIVIDE(X,Y)


The table looks like this:

Steen92_2-1606467743255.png

 

I have tried ALL instead of ALLSELECTED to, but then the year is not taken into to calculation...

 

I use the following tables:

Date table (for the months)
Hour table (for the hours)
Hour type table (for the translation of the hours)

 

Hopefully you can help me out guys, I'd really appreciate it.

 

Kind regards,

Ramon

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try like

DIVIDE(SUM(Hours[Hours]),calculate(SUM(Hours[Hours]),allexcept(Table,Table[Month])))

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , Try like

DIVIDE(SUM(Hours[Hours]),calculate(SUM(Hours[Hours]),allexcept(Table,Table[Month])))

Anonymous
Not applicable

I found the solution and it was much closer than expected. Feel very stupid and a waste of time.

Displaying the option value as a percentage of column total had completely eluded me.

In any case, thank you very much for the effort !

Anonymous
Not applicable

Hi Amitchandak,


Thank you for your reaction!

Unfortunately, the formula doesn't seem to work...`I have hours of 2019 and 2020. And now te percentages where calculate for both years together...

% hour type = DIVIDE(SUM(Hours[Hours]),calculate(SUM(Hours[Hours]),allexcept(Date table,Date table[Month])))

Steen92_0-1606470884623.png

Is there anything I can do to clarify the problem?

 

Kind regards,
Ramon

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.