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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
unnijoy
Post Prodigy
Post Prodigy

Formula help

I have a table with EMPID,MONTH and SALARY. Every month most of the employeeid will remain same. Siome times new EMPID may added or some may be removed. When i try to calculate the total salary for like three month the formula is taking the same amount repetedly. Now i need a formula which will calculate the slarly in such a way that if the same employee id is repoeating it should take that employee id and salary only once.

 

MONTHEMPIDSalary
5/1/20181011000
5/1/201810220000
5/1/201810360000
5/1/201810480000
5/1/201810550000
6/1/20181011000
6/1/201810220000
6/1/201810360000
6/1/201810480000
6/1/201810550000

 

In short if am selecting both May and june the overall salary should come 211000. 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@unnijoy,

Create the following columns in your table.

Monthnumber = MONTH(Table[MONTH])
Rank = RANKX(FILTER(Table,Table[EMPID]=EARLIER(Table[EMPID])),Table[Monthnumber],,ASC)


Then create the following measures in your table.

multiselect = CALCULATE(sum(Table[Salary]),FILTER(Table,Table[Rank]=1))

result = IF(HASONEFILTER(Table[Monthnumber]),SUM(Table[Salary]),[multiselect])

1.PNG


Regards,
Lydia

View solution in original post

1 REPLY 1
Anonymous
Not applicable

@unnijoy,

Create the following columns in your table.

Monthnumber = MONTH(Table[MONTH])
Rank = RANKX(FILTER(Table,Table[EMPID]=EARLIER(Table[EMPID])),Table[Monthnumber],,ASC)


Then create the following measures in your table.

multiselect = CALCULATE(sum(Table[Salary]),FILTER(Table,Table[Rank]=1))

result = IF(HASONEFILTER(Table[Monthnumber]),SUM(Table[Salary]),[multiselect])

1.PNG


Regards,
Lydia

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.