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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
xuexi1890
Helper I
Helper I

distinctcount of product with lowest price (all) for each distributor

Hello,

below is my dataset (as an example), I want to calculate how many products with lowest price sold of each distributor, same as SummaryTable1, meanwhile having another SummaryTable2 to show me what are the cases.
Untitled.png
thank you so much for helping me out!

my initial attempt was to create an array of numbers (each product code with min price) and then use this array as a criterion to filter in my dataset when the product is the same and the price is equal to the min price, but of course failed. I don't quite understand the concept of PBI when the array is relevant to a certain column (same product).

Sincerely,
Nate

1 ACCEPTED SOLUTION

@v-chuncz-msft 

thanks Sam. i tried myself and succeeded.

 

i put it here if anyone is interested.

 

MinPrice =
VAR _Quarter=ALLSELECTED(Table1[Quarter])
VAR _Month=ALLSELECTED(Table1[Month])
Return
CALCULATE(
min(Table1[price]),
ALL(Table1),
values(Table1[Product]),
Table1[Quarter] IN _Quarter,
Table1[Month] IN _Month
)
 
DistinctCount of CP =
VAR _Quarter=ALLSELECTED(Table1[Quarter])
VAR _Month=ALLSELECTED(Table1[Month])
Return
CALCULATE(
DISTINCTCOUNT(Table1[Product]),
FILTER(ALLEXCEPT(Table1,Table1[Quarter],Table1[Month]),Table1[price]=[MinPrice]),
VALUES(Table1[Distributor]),
Values(Table1[Product]),
Table1[Quarter] IN _Quarter)

View solution in original post

2 REPLIES 2
v-chuncz-msft
Community Support
Community Support

@xuexi1890 

 

You may add a calculated column first.

Column =
IF (
    'Table'[Price]
        = MINX (
            FILTER ( 'Table', 'Table'[Product] = EARLIER ( 'Table'[Product] ) ),
            'Table'[Price]
        ),
    1
)
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-chuncz-msft 

thanks Sam. i tried myself and succeeded.

 

i put it here if anyone is interested.

 

MinPrice =
VAR _Quarter=ALLSELECTED(Table1[Quarter])
VAR _Month=ALLSELECTED(Table1[Month])
Return
CALCULATE(
min(Table1[price]),
ALL(Table1),
values(Table1[Product]),
Table1[Quarter] IN _Quarter,
Table1[Month] IN _Month
)
 
DistinctCount of CP =
VAR _Quarter=ALLSELECTED(Table1[Quarter])
VAR _Month=ALLSELECTED(Table1[Month])
Return
CALCULATE(
DISTINCTCOUNT(Table1[Product]),
FILTER(ALLEXCEPT(Table1,Table1[Quarter],Table1[Month]),Table1[price]=[MinPrice]),
VALUES(Table1[Distributor]),
Values(Table1[Product]),
Table1[Quarter] IN _Quarter)

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.