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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
brabby_dabby
Frequent Visitor

Create Quartiles by Groups and Removing Specific Values

Hello, this questions has been answered, but this is a variation that I need a little more help on.

I have a dataset that looks like this:

TimeClass1Class2Subclass1Subclass2VendorSKURate

12

1REF11FDRA111.089
121REF11FDRB112.112
121REF11FDRC113.121
121REF11FDRD121.080
121REF11FDRE122.065
121REF11FDRF131.050
121REF12SSA141.112
121REF12SSB151

.131

121REF12SSC161.054

I have a lot more Times, Classes, Subclasses, SKUs, and Vendors...

I want to calculate the first and third quartiles.

Quartile1, for example, I want to group all the 'FDR' values together that are under 'SUBCLASS2' that have the same 'Time' value and calculate the first Quartile.

This is where it gets confusing: For the first row in 'Subclass' = 'FDR' under Vendor A, I would like to calculate the 1st Quartile, BUT, instead of including 'Vendor A', I would like to remove that vendor from the quartile calculation. Therefore, for Time=12, Class2 = REF, Subclass2 = FDR, and Vendor = A, the quartile should be 0.065.

TimeClass1Class2Subclass1Subclass2VendorSKURateQuartile1Quartile3

12

1REF11FDRA111.0890.0650.112
121REF11FDRB112.1120.0650.089
121REF11FDRC113.1210.0650.089
121REF11FDRD121.0800.0650.112
121REF11FDRE122.0650.0800.112
121REF11FDRF131.0500.0800.112

And for Vendor B, it would be the same, but I would like to remove vendor B from that Subclass/Time grouping. And so on...

I started by creating a table and then using the following equation to create the quartiles:

 

Quartile1 = SUMMARIZE(dataset, dataset[Class1],dataset[Class2],dataset[Subclass1], dataset[Subclass2],dataset[Vendor],"Q1", PERCENTILE.INC(dataset[rate],0.25))

 

But I'm not sure how to tell Power BI that I want to to remove that specific vendor when calculating Quartile1.

Thank you for your help. I am not very familiar with DAX and have been trying to figure this out for a while without any success.

5 REPLIES 5
Anonymous
Not applicable

Hi @brabby_dabby ,

 

I am sorry. I also don't know what Temp_Table and Main_Table are. How to get 0.65 and 0.8. Why the rate data is not the same? Can you provide more detailed data and desired output?

 

Best Regards

Community Support Team _ polly

@AlexisOlson @Anonymous 

I am sorry, I changed the table names on you:

  • Temp_Table = Quartile1 Table. Because I'm summarizing I have to make a summary table and can't do calculated column or measure.
  • Main_Table = dataset

The 0.65 and 0.8 are the Quartiles that I calculated manually (I have thousands of rows so this isn't a possibility on my data). For example, In a normal scenario, if I am calculating the first Quartile for the FDR Subclass for Time 12, normally, I would just group everything from 'dataset':

TimeClass1Class2Subclass1Subclass2VendorSKURate

12

1REF11FDRA111.089
121REF11FDRB112.112
121REF11FDRC113.121
121REF11FDRD121.080
121REF11FDRE122.065
121REF11FDRF131.050

But, for my reasons, I want to calculate the first quartile for Vendor A, but I want to remove Vendor A from the calculation so the 'Rate' that I'm using for this particular grouping is only using the following Vendors (For FDR subclass and Time 12): 

TimeClass1Class2Subclass1Subclass2VendorSKURate
121REF11FDRB112.112
121REF11FDRC113.121
121REF11FDRD121.080
121REF11FDRE122.065
121REF11FDRF131.050

 

And the same logic applies for all the other vendors. When I want to calculate the first quartile for vendor B, I want to remove Vendor B's rate from the calculation. And for Vendor C, I want to remove Vendor C's rate from the calculation...etc.

brabby_dabby
Frequent Visitor

@AlexisOlson The equation you presented looks like it works in Temp_Table. But when I try a LOOKUPVALUE to import Temp_Table[Quartile1] to the Main_Table, I'm getting a circular depency error.

Sorry, I don't know what Temp_Table and Main_Table are. The only table you mention in the post is 'dataset'.

AlexisOlson
Super User
Super User

You could try REMOVEFILTERS:

 

Quartile1 =
SUMMARIZE (
    dataset,
    dataset[Class1],
    dataset[Class2],
    dataset[Subclass1],
    dataset[Subclass2],
    dataset[Vendor],
    "Q1",
        CALCULATE (
            PERCENTILE.INC ( dataset[rate], 0.25 ),
            REMOVEFILTERS ( dataset[Vendor] )
        )
)

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors