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
StefanLux
New Member

Newest values for sums of discrete ids

Hi all,

 

I have a quite big Data-Table (PowerPivot), here are just some example rows/colomns:

pers_iddatemeasureage
122024-01-31142
132024-01-31042
182024-01-31143
192024-01-31117
202024-01-31042
122024-02-29043
212024-02-29043
182024-02-29043
122024-03-31143
202024-03-31043

 

The table shows some reports (from date) for person (pers_id) with result measure and age.

I need the results for single month, but also for time periods.

My pivot tables look like:

Agediscrete Pers_id
171
423
434
Total6

and

Measurediscrete Pers_id
05
13
Total6

 

which is of course wrong, because the pers_id are not unique in the table.

But I just need the newest data depending on the date (per pers_id).

So the january data for pers_id 12 is only needed, if I choose january in the date slicer.
The will never be duplicates with same pers_id and date.

 

Can you help me?

 

Thanks in advance,

Stefan

1 ACCEPTED SOLUTION

Hi @StefanLux ,

Please refer to .

vrongtiepmsft_0-1708914464143.pngvrongtiepmsft_1-1708914480585.pngvrongtiepmsft_2-1708914498519.png

Best Regards
Community Support Team _ Rongtie

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

View solution in original post

5 REPLIES 5
v-rongtiep-msft
Community Support
Community Support

Hi @StefanLux ,

Please have a try,.

Create a meaure.

Measure2 =
VAR _1date =
    SELECTEDVALUE ( 'Table 2'[date] )
VAR _2 =
    CALCULATE (
        COUNT ( 'Table'[age] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[date] = SELECTEDVALUE ( 'Table'[date] )
                && 'Table'[age] = SELECTEDVALUE ( 'Table'[age] )
        )
    )
RETURN
    IF (
        MAX ( 'Table'[date] ) = _1date,
        _2,
        IF ( _1date = BLANK (), _2, BLANK () )
    )

vrongtiepmsft_0-1708483510875.png

 

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
Community Support Team _ Rongtie

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

 

 

 

 

Hi Rongtie,

 

thanks for your quick response.

I checked your measure, but it not yet the solution.

What I have to do is to count the discrete pers_id per age/month and age/period.

So, for this example the desired output would be:

 

January 
Agediscrete Pers_id
171
423
431
Total5
  
  
February 
Agediscrete Pers_id
433
Total3
  
  
January + February 
Agediscrete Pers_id
171
422
433
Total6
  
  
February + March 
Agediscrete Pers_id
434
Total4
  
  
January - March 
Agediscrete Pers_id
171
421
434
Total6

 

You think it is possible?

 

Thanks in advance,

Stefan

Hi @StefanLux ,

Maybe I really get what you're saying.

vrongtiepmsft_0-1708652070153.pngvrongtiepmsft_1-1708652081715.png

Please refer to my pbix file.

 

Best Regards
Community Support Team _ Rongtie

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

Hi Rongtie,

 

thanks again for your quick response.

Please check, there are only 6 people (show only the newest row per pers_id), but you have 10.StefanLux_0-1708685664579.png

Thanks in advance,

Stefan

Hi @StefanLux ,

Please refer to .

vrongtiepmsft_0-1708914464143.pngvrongtiepmsft_1-1708914480585.pngvrongtiepmsft_2-1708914498519.png

Best Regards
Community Support Team _ Rongtie

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

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.