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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric 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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.