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

Aggregate / sum id based on 3 activities per day

Hello,

 

I have this table:

 

iddateactivityactivity_count
3081-Jun-22a312
3081-Jun-22c39
3081-Jun-22b80
3082-Jun-22c251
3082-Jun-22b222
3083-Jun-22a50
3083-Jun-22c223
3083-Jun-22b171
3084-Jun-22b302
3084-Jun-22c106
3084-Jun-22a23

 

I am a bit stuck with how to do the following:

 

I would like to generate a table or measure that sums the "activity_count" for the 3 activities "activity" (a, b and c), per day, per id

 

Example: For id 308, the sum of the 3 activities (a, b and c) is 312+39+80 = 431, resulting in one line for this:

 

3081-Jun-22431

 

This is then repeated per day, per id 

 

3081-Jun-22431
3082-Jun-22402
9413-Jun-22235

 

Any ideas?

 

Cheers,

Carsten

3 ACCEPTED SOLUTIONS
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

 

Untitled.png

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

v-easonf-msft
Community Support
Community Support

Hi, @Anonymous 

Try steps as below:

1.enter a table "Activity Table" as below:

veasonfmsft_0-1656410542025.png

2. add a measure like:

Result = 
IF (
    SELECTEDVALUE ( 'Activity Table'[activity] ) IN VALUES ( 'Table'[activity] ),
    CALCULATE (
        SUM ( 'Table'[activity_count] ),
        FILTER ( 'Table', 'Table'[activity] = MAX ( 'Activity Table'[activity] ) )
    ),
    IF (
        SELECTEDVALUE ( 'Activity Table'[activity] ) = "Sum",
        CALCULATE ( SUM ( 'Table'[activity_count] ) ),
        BLANK ()
    )
)

3.apply this new field to a table visual

veasonfmsft_2-1656410705811.png

Best Regards,
Community Support Team _ Eason

 

View solution in original post

Anonymous
Not applicable

Dear all, 

 

Thanks a lot for all your input (very much appreciated) and sorry for my late response. In the end, while working on the report, I have ended up creating a table dedicated to this (data qualit scores), supported by a group by function.

 

Cheers, Carsten

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Dear all, 

 

Thanks a lot for all your input (very much appreciated) and sorry for my late response. In the end, while working on the report, I have ended up creating a table dedicated to this (data qualit scores), supported by a group by function.

 

Cheers, Carsten

v-easonf-msft
Community Support
Community Support

Hi, @Anonymous 

Try steps as below:

1.enter a table "Activity Table" as below:

veasonfmsft_0-1656410542025.png

2. add a measure like:

Result = 
IF (
    SELECTEDVALUE ( 'Activity Table'[activity] ) IN VALUES ( 'Table'[activity] ),
    CALCULATE (
        SUM ( 'Table'[activity_count] ),
        FILTER ( 'Table', 'Table'[activity] = MAX ( 'Activity Table'[activity] ) )
    ),
    IF (
        SELECTEDVALUE ( 'Activity Table'[activity] ) = "Sum",
        CALCULATE ( SUM ( 'Table'[activity_count] ) ),
        BLANK ()
    )
)

3.apply this new field to a table visual

veasonfmsft_2-1656410705811.png

Best Regards,
Community Support Team _ Eason

 

Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

 

Untitled.png

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


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.

Top Solution Authors