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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
elemesey
Frequent Visitor

Filtered Sales in Customer master without using relationship

Hi guys,

I'm beginner in Power BI and need help.

I need a DAX column with my customer list that will show their sales in the slicers based on the year and item group selected from the sales data without the use of a relationship.

elemesey_0-1696906292834.png



This is the sample result I'm looking for:

elemesey_1-1696906319360.png

Test File - https://drive.google.com/file/d/10VLWUhmGCSoHUxvK4yeiR77mKlbNMBcA/view?usp=drive_link 

Thank you in advance, and I appreciate everyone! 😊



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

Hi @elemesey ,

I updated your sample pbix file(see the attachment), please check if that is what you want.

1. Delete the relationship between the table 'Fiscal Year based on Sales' and 'Sales'

vyiruanmsft_0-1697093558943.png

2. Create two measures as below 

 

Measure = 
VAR _cust =
    SELECTEDVALUE ( 'Allcustomer'[Customer] )
VAR _fyears =
    ALLSELECTED ( 'Fiscal Year based on Sales'[Fiscal Year 2] )
VAR _fmonths =
    ALLSELECTED ( 'Fiscal Year based on Sales'[Fiscal Month] )
VAR _itemgroups =
    ALLSELECTED ( Sales[Item Group] )
VAR _dates =
    CALCULATETABLE (
        VALUES ( 'Fiscal Year based on Sales'[Date] ),
        FILTER (
            'Fiscal Year based on Sales',
            'Fiscal Year based on Sales'[Fiscal Year 2]
                IN _fyears
                    && 'Fiscal Year based on Sales'[Fiscal Month] IN _fmonths
        )
    )
RETURN
    CALCULATE (
        SUM ( 'Sales'[Sales] ),
        FILTER (
            ALLSELECTED ( 'Sales' ),
            'Sales'[Customer] = _cust
                && 'Sales'[Date]
                IN _dates
                    && 'Sales'[Item Group] IN _itemgroups
        )
    )
Sum of sales = SUMX(VALUES('Allcustomer'[Customer]),[Measure])

 

vyiruanmsft_1-1697093655193.png

Best Regards

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

1 REPLY 1
v-yiruan-msft
Community Support
Community Support

Hi @elemesey ,

I updated your sample pbix file(see the attachment), please check if that is what you want.

1. Delete the relationship between the table 'Fiscal Year based on Sales' and 'Sales'

vyiruanmsft_0-1697093558943.png

2. Create two measures as below 

 

Measure = 
VAR _cust =
    SELECTEDVALUE ( 'Allcustomer'[Customer] )
VAR _fyears =
    ALLSELECTED ( 'Fiscal Year based on Sales'[Fiscal Year 2] )
VAR _fmonths =
    ALLSELECTED ( 'Fiscal Year based on Sales'[Fiscal Month] )
VAR _itemgroups =
    ALLSELECTED ( Sales[Item Group] )
VAR _dates =
    CALCULATETABLE (
        VALUES ( 'Fiscal Year based on Sales'[Date] ),
        FILTER (
            'Fiscal Year based on Sales',
            'Fiscal Year based on Sales'[Fiscal Year 2]
                IN _fyears
                    && 'Fiscal Year based on Sales'[Fiscal Month] IN _fmonths
        )
    )
RETURN
    CALCULATE (
        SUM ( 'Sales'[Sales] ),
        FILTER (
            ALLSELECTED ( 'Sales' ),
            'Sales'[Customer] = _cust
                && 'Sales'[Date]
                IN _dates
                    && 'Sales'[Item Group] IN _itemgroups
        )
    )
Sum of sales = SUMX(VALUES('Allcustomer'[Customer]),[Measure])

 

vyiruanmsft_1-1697093655193.png

Best Regards

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

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.