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
Ocelote
Frequent Visitor

How to create a MEASURE that: SUMMARIZE DISTINCT, ignore slicer and a fixed FILTERING of the data

Dears,

 

Looking for a hint on how to achieve the creation of a measure (to be used in other calculation) as I will try to describe below: 

 

INPUT: I want to only work on the bold part of the below table, basically date A and only 3M ahead.

GPIDPeriodM1M2M3M4M5M6
EU1A101010101010
US2A 11111
EU3A   555
US2A11    
EU4A888   
EU1B 1010101010
US2B 11111
EU3B   555
US4B 121212  

 

INTERMEDIATE TABLE

GPIDValue
EU110
EU48
US21

 

My goal is to filter out the data I do not need (Period B & Date > M3), Group by distinct ID and sum the result by group. One ID has always the same value but can appear in different moment in time.

Also, it needs to ignore the slicer so that even if I select M4, it will display the fixed value (as initial range should be fixed)

 

OUTPUT:

GPSum(Value)
EU18
US1

 

I tried a lot of methods to get it into a measure. It only works when I make a separate table with the below code but then I cannot use the output for another calculation:

 

 

 

MEASURE = SUMX(SUMMARIZE(filter(table, table[Date]=A && table[M]<[M3]  ),table[GP],table[Value]),'table'[Value])

 

 

 

 

Thank you for your help !

1 ACCEPTED SOLUTION
v-yuaj-msft
Community Support
Community Support

Hi @Ocelote ,

 

Based on your description, you can create a measure as follows.

Measure = 

var x1=SUMMARIZE(FILTER('Table',[Period]="A"),'Table'[GP],'Table'[ID],'Table'[M1],'Table'[M2],'Table'[M3])

var x2=FILTER(SUMMARIZE(x1,'Table'[GP],'Table'[ID],"Value",MAX('Table'[M1])),[Value]<>BLANK())

return

SUMX(x2,[Value])
Result:

v-yuaj-msft_0-1612493006012.png

 

Hope that's what you were looking for.

Best Regards,

Yuna

 

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-yuaj-msft
Community Support
Community Support

Hi @Ocelote ,

 

Based on your description, you can create a measure as follows.

Measure = 

var x1=SUMMARIZE(FILTER('Table',[Period]="A"),'Table'[GP],'Table'[ID],'Table'[M1],'Table'[M2],'Table'[M3])

var x2=FILTER(SUMMARIZE(x1,'Table'[GP],'Table'[ID],"Value",MAX('Table'[M1])),[Value]<>BLANK())

return

SUMX(x2,[Value])
Result:

v-yuaj-msft_0-1612493006012.png

 

Hope that's what you were looking for.

Best Regards,

Yuna

 

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

lbendlin
Super User
Super User

on what granularity level?

ID (distinct) level 🤗

lbendlin
Super User
Super User

why are there two entries for A - 2 - US - M2 ?

Because it is possible in my dataset, I need to remove duplicates.

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.