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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
sridharbabu
Helper I
Helper I

Remove duplicates

from backend taking two months of data and showing in power bi table

 

month item location type qty
Apr-245456 london pen44
Mar-245456londonpen 46
Apr-245433london pencil34
Mar-245433londonpen 26

here if item, location,type is same for two months, sum of qty and show it, if item , location is same and type is different then show the latest moth type, in the table having other columns and measures also.
this is the required output.   how to achieve in power bi dax.

month item location type qty
Apr-245456 london pen90
Apr-245433london pencil60

 

4 REPLIES 4
Anonymous
Not applicable

Your ideas so great @Idrissshatila , Allow me to offer another insight:

Hi, @sridharbabu 

Perhaps you can create a measure using the following DAX expression:

qty measure = 
VAR _date = SELECTEDVALUE('Table'[month])
VAR _item = CALCULATE(MAX('Table'[item]),'Table'[month]=_date)
VAR _location = CALCULATE(MAX('Table'[location]),'Table'[month]=_date)
VAR _type = CALCULATE(MAX('Table'[type]),'Table'[month]=_date)
VAR _max_day = MAXX(ALL('Table'),'Table'[month])
VAR _item_max = CALCULATE(MAX('Table'[item]),'Table'[month]=_max_day)
VAR _location_max = CALCULATE(MAX('Table'[location]),'Table'[month]=_max_day)
VAR _type_max = CALCULATE(MAX('Table'[type]),'Table'[month]=_max_day)
RETURN IF(_item=_item_max&&_location=_location_max&&_type=_type_max&&_date=_max_day,SUMX(FILTER(ALL('Table'),'Table'[item]=_item_max),'Table'[qty]),IF(_date=_max_day,SUMX('Table','Table'[qty])))

The table visual is set as follows:

vjianpengmsft_0-1716347834132.png

Here are the results:

vjianpengmsft_1-1716347868963.png

I've provided the PBIX file used this time below.

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Thankyou for the solution. In the table apart from above columns, also having other columns and measures showing in the table. and to show top 100. totally showing 12 columns including measures. for all same process.

Anonymous
Not applicable

Hi, @sridharbabu 

Thank you very much for your reply. Has the current issue been resolved? Do you provide some sample data for your description and the output you are looking forward to. If you've already fixed the current issue, you can share your solution here and mark it as a solution so that others in the community can quickly find a solution if they encounter the same problem.

 

 

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Idrissshatila
Super User
Super User

Hello @sridharbabu,

 

you could acheive the following using group by https://learn.microsoft.com/en-us/power-query/group-by

 



Did I answer your question? Mark my post as a solution! Appreciate your Kudos
Follow me on LinkedIn linkedIn
Vote for my Community Mobile App Idea

Proud to be a Super User!




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.