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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
han_rj
Helper IV
Helper IV

Find Customer sales where customers bought few products together

I need to find customer sales only when customer buys all 3 products of Sofa, Chair, Table. Attaching the sample screenshort of the expected output , Please may I have help.

han_rj_0-1723610392188.png

 

1 ACCEPTED SOLUTION

ThxAlot_0-1723644760946.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



View solution in original post

18 REPLIES 18
ThxAlot
Super User
Super User

ThxAlot_0-1723630462959.png

 

For fun only, to showcase the powerful Excel formulas,

ThxAlot_1-1723630527352.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



This is awesome, One small question is it possible to eliminate other rows and only have customer a,f in the matrix

 

han_rj_0-1723632492997.png

 

ThxAlot_0-1723644760946.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



Hi @ThxAlot , Thank You for helping , As a last tweak at times I have entries of blank/nulls in my fact table along side customer,product sku , Where a solution to show only entries without blanks will be helpful

han_rj_0-1723652656004.png

 

Hi @ThxAlot , Please can you help me explain the flow of the above logic, It seems I will need to make few tweaks to mine, So understanding it will help me make the tweeks

Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_1-1723611647040.png

 

 

Jihwan_Kim_0-1723611624348.png

 

 

sales total: =
VAR _sales =
    SUM ( fct_sales[sales] )
VAR _productcountall =
    COUNTROWS ( VALUES ( dim_product[product] ) )
VAR _productcountonlysales =
    COUNTROWS ( SUMMARIZE ( fct_sales, dim_product[product] ) )
RETURN
    SWITCH (
        TRUE (),
        HASONEVALUE ( dim_customer[customer] ), IF ( _productcountonlysales = _productcountall, _sales ),
        _sales
    )

 


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.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

I will give this a try, the above attached data is a sample data and I would like to put a condition only to compute sales for 3 specifc products [Sofa , Chair and Table] scenario , else it should show zero. But I will give this a try , Thank you

Hi,

My calculation has the condition to compare "how many products per customer" vs. "count of all products in dimension table".

If you need to compare to three specific products, please try hard-code the products names, instead of dynamically comparing to ALL.

Thank you.


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.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Hi @Jihwan_Kim , I did try filtering, but I guess I am missing something attaching the changes made and the data

han_rj_2-1723615132341.png

 

Hi, I am not sure if it works in the other semantic model than the sample that I provided, but please try something like below.


Please check the attached pbix file.

 

 

Jihwan_Kim_0-1723620173550.png

 

sales total: =
VAR _sales =
    SUM ( fct_sales[sales] )
VAR _productcountall =
    COUNTROWS (
        FILTER (
            VALUES ( dim_product[product] ),
            dim_product[product] IN { "chair", "sofa", "table" }
        )
    )
VAR _productcountonlysales =
    COUNTROWS (
        FILTER (
            SUMMARIZE ( fct_sales, dim_product[product] ),
            dim_product[product] IN { "chair", "sofa", "table" }
        )
    )
RETURN
    SWITCH (
        TRUE (),
        HASONEVALUE ( dim_customer[customer] ), IF ( _productcountonlysales = _productcountall, _sales ),
        _sales
    )

 


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.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Yea, Does not work for my model

Irwan
Super User
Super User

hello @han_rj 

 

please check if this accomodate your need.

Irwan_0-1723611035618.png

the easiest way is to achieve this is filter out customer that has not bought 3 item.

 

1. create new measure to count bought item

Filter =
var _Count = COUNT('Table'[Column3])
Return
IF(
    _Count=3,
    1,
    0
)
2. in your matrix visual, insert the measure
Irwan_1-1723611182290.png

3. in visual filter pane, set to show value only 1. value 1 means customer that has bought 3 items.

Irwan_2-1723611244350.png

4. if you dont want to show those count value, lock the filter then remove the measure after being locked. the filter will be stayed there while no value is shown.

Irwan_4-1723611404566.png

 

Irwan_5-1723611443001.png

 

however, as you can see, the total will be different from original, because only customer with 3 item will be count in total.


 Hope this will help.

Thank you.

The above data is a sample data, I want specific condition on Sofa , Chair and Table , Because I have other items as well.

hello @han_rj 

 

you can adjust the filter DAX just only to calculate those 3 items.

Filter =
var _Count = CALCULATE(COUNT('Table'[Column3]),FILTER('Table','Table'[Column2]="Chair"||'Table'[Column2]="Sofa"||'Table'[Column2]="Table"))
Return
IF(
    _Count=3,
    1,
    0
)

Irwan_0-1723612158403.png


Thank you.

 

Hi @Irwan , This works but when we export data and open the csv file it is blank

 

Power BI desktop Data :

han_rj_0-1723614908908.png

Excel Data 

han_rj_1-1723614931478.png

 

@han_rj 

 

Then i guess the problem is in exporting option, not the DAX. If the DAX doesnt work, then it will show wrong result or it will show no result.

 

You might want to recheck your selection when exporting.

 

Thank you.

if I exclude the filter I am able to view exported data[CSV file data], when the filter is on the exported data is blank

 

Hmm not sure why. I used this method multiple times and no issue when exporting.

 

 

 

Well if this not works, the next way is @Jihwan_Kim's solution.

 

 

 

Thank you.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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