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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Dimitris_Kats
Helper V
Helper V

Totals doesn't show

Hello dear members.

 

I have a table with the following information:

Division   Department     Job Position                                 Employee        Payroll Cost

IT                   IT            SUPPORT BUSINESS ANALYST     EMPLOYEE1        1000

IT                  IT             SOFTWARE ENGINEER                  EMPLOYEE2        1200
HR                HR           RECRUITER                                    EMPLOYEE3        1000
HR                HR           RECRUITER                                    EMPLOYEE4        1000

 

I have created also a table with all the employees and all the percentages from 1%-100% per employee

 

And i have created the following measure:

VAR LastNonZeroDate =
CALCULATE (MAX ( Table1[PERIOD_WID]),
FILTER ( Table1, Table1 [Salary] <> 0 ), filter(Table1, Table1 [Employee_ID] = SELECTEDVALUE('Percentage - Name'[Employee_ID])))
return
IF(distinctCOUNT('Percentage - Name'[Percentages.Percentage])>1, CALCULATE(SUM(Table1 [Salary]) , Table1 [PERIOD_WID]=LastNonZeroDate), IFERROR( CALCULATE(SUM(Table1 [Salary]), Table1 [PERIOD_WID]=LastNonZeroDate)*(1+MAX('Percentage - Name'[Percentages.Percentage])),BLANK()))

 

The idea is the user to choose from a slicer the person and the percentage and the salary to increase accordingly 

The desirebale table:

Division  Department    Job Position                                Employee     Payroll Cost    Percentage  New Cost

IT                    IT            SUPPORT BUSINESS ANALYST    EMPLOYEE1     1000                  5%           1050

IT                   IT             SOFTWARE ENGINEER                EMPLOYEE2      1200                10%          1320
HR                 HR           RECRUITER                                  EMPLOYEE3      1000                 5%            1050
HR                 HR           RECRUITER                                  EMPLOYEE4      1000               10%            1100

 

The measures works fine but the column new cost totals are blank.

 

I have tried to wrap it in summarize and sumx but the problem remains. I suppose there is a problem with my formula.

 

Can you please help me out??

1 ACCEPTED SOLUTION
Dimitris_Kats
Helper V
Helper V

Ok, i managed to resolve the problem with the totals that wasn't showing. I removed a filter. But now i have another problem with totals.

VAR LastNonZeroDate =
CALCULATE (MAX ( Table1[PERIOD_WID]),
FILTER ( Table1, Table1 [Salary] <> 0 ))
return
IF(distinctCOUNT('Percentage - Name'[Percentages.Percentage])>1, CALCULATE(SUM(Table1 [Salary]) , Table1 [PERIOD_WID]=LastNonZeroDate), IFERROR( CALCULATE(SUM(Table1 [Salary]), Table1 [PERIOD_WID]=LastNonZeroDate)*(1+MAX('Percentage - Name'[Percentages.Percentage])),BLANK()))
 
The problem now is that it doesn't sum the total per row but is takes the column total and multiply it with the selected percentage and it gives me wrong results.
Any idea?

View solution in original post

2 REPLIES 2
Dimitris_Kats
Helper V
Helper V

I Fixed it and i am writting the solution in case someone else need it.

I created a suumerized table

 

VAR LastNonZeroDate =
CALCULATE (MAX ( Table1[PERIOD_WID]),
FILTER ( Table1, Table1[Salary] <> 0 ) )
VAR Correcttotals = SUMMARIZE(Table1,Table1[Job Description], Table1[Salary], Table1[PERIOD_WID], "Totals", IF(distinctCOUNT('Percentage - Name'[Percentages.Percentage])>1, CALCULATE(SUM(Table1[Salary]) Table1[PERIOD_WID]=LastNonZeroDate), IFERROR( CALCULATE(SUM(Table1[PERIOD_WID]), Table1[PERIOD_WID]=LastNonZeroDate)*(1+MAX('Percentage - Name'[Percentages.Percentage])),BLANK())))
 
return
IF(HASONEVALUE('Table1'[Employee ID]),IF(distinctCOUNT('Percentage - Name'[Percentages.Percentage])>1, CALCULATE(SUM(Table1[Salary]) ,Table1[PERIOD_WID]=LastNonZeroDate), IFERROR( CALCULATE(SUM(Table1[Salary]), Table1[PERIOD_WID]=LastNonZeroDate)*(1+MAX('Percentage - Name'[Percentages.Percentage])),BLANK())),sumx(Correcttotals, [Totals]))
Dimitris_Kats
Helper V
Helper V

Ok, i managed to resolve the problem with the totals that wasn't showing. I removed a filter. But now i have another problem with totals.

VAR LastNonZeroDate =
CALCULATE (MAX ( Table1[PERIOD_WID]),
FILTER ( Table1, Table1 [Salary] <> 0 ))
return
IF(distinctCOUNT('Percentage - Name'[Percentages.Percentage])>1, CALCULATE(SUM(Table1 [Salary]) , Table1 [PERIOD_WID]=LastNonZeroDate), IFERROR( CALCULATE(SUM(Table1 [Salary]), Table1 [PERIOD_WID]=LastNonZeroDate)*(1+MAX('Percentage - Name'[Percentages.Percentage])),BLANK()))
 
The problem now is that it doesn't sum the total per row but is takes the column total and multiply it with the selected percentage and it gives me wrong results.
Any idea?

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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