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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

How can I remove duplicated values for same category ID

Hello everyone !

 

I am facing an issue with my report right now, I need to calculate efficacity (theorical time divided by real time) for different activities.

The problem is that in order to get the theorical time I need to merge 2 tables (main table & theorical time table) by activity ID. 

As I have different real activities that have the same ID (since it is related to the same activity), my theoretical time is multiplied by the number of rows I have for the same activity ID.


Here is a sample of data that I have in my dataset :

AriB_0-1678806371059.png

 

I would then like to be able to obtain the theoretical time associated with my activity ID in the first line of my activity ID for example.

 

Thank you for the help you can provide me with that topic 🙏

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I just found how to convert @Greg_Deckler's measure into calculated column, which reach the result expected.

Here is the formula :

Theorical time column = 
    VAR __Activity = 'Table'[Activity ID]
    VAR __MaxActivity = 
        MAXX(
            FILTER(
                ALL('Table'),
                [Activity ID] = __Activity
            ),
            [real time]
        )
    VAR __TpsTheoAppro = 'Table'[theorical time]
    VAR __Result = IF('Table'[real time] = __MaxActivity, __TpsTheoAppro, BLANK())
RETURN
    __Result

 

Result is the following :

AriB_0-1678866356034.png

The theorical time is shown only once per Activity ID.

 

Thanks again for great help

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

I just found how to convert @Greg_Deckler's measure into calculated column, which reach the result expected.

Here is the formula :

Theorical time column = 
    VAR __Activity = 'Table'[Activity ID]
    VAR __MaxActivity = 
        MAXX(
            FILTER(
                ALL('Table'),
                [Activity ID] = __Activity
            ),
            [real time]
        )
    VAR __TpsTheoAppro = 'Table'[theorical time]
    VAR __Result = IF('Table'[real time] = __MaxActivity, __TpsTheoAppro, BLANK())
RETURN
    __Result

 

Result is the following :

AriB_0-1678866356034.png

The theorical time is shown only once per Activity ID.

 

Thanks again for great help

Greg_Deckler
Super User
Super User

@Anonymous Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hi @Greg_Deckler ,

 

Thank you for your reply, I just checked among the common issues you shared but unfortunately didn't found it.

Here is a text sample of the data I actualy have :

Activity ID |real time |theorical time
11025
1725
22050
1525
2350

 

The expected result is the following :

Activity ID |real time |theorical time
11025
17 
22050
15 
23 

 

To reach the expected result, I would like to check for each Activity ID if there is more than one row (in the example below: 3 rows for Activity ID n°1, 2 rows for Activity ID n°2. If there is more than 1 row for each Activity ID, I would like to replace the duplicates in the theorical time column for one Activity ID with blank value. 

 

Hope that my request is more clear now

@Anonymous See PBIX attached below signature.

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler it fits my needs perfectly !

But how can I convert this measure as calculated column instead ?

 

Thank you for the help provided !

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.