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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
filip_u_s
Regular Visitor

Calculation excluding condition

Hi.

I'm a bit rusty and I'm not getting this simple DAX-formula to work.
The formula below is simplified to focus on the problem.
There are two tables, one Core-table and one Data-table and both have an identical ID-column that linkes them both.
However the below formula gives me all values... including the once of the selected "Transportör".

Formula

Förbrukning=
    CALCULATE(
        SUM(Data[Förbrukning]),
        FILTER(Core,Core[Transportör]<>SELECTEDVALUE(Core[Transportör])
    )
1 ACCEPTED SOLUTION
v-jiewu-msft
Community Support
Community Support

Hi @filip_u_s ,

If I understand correctly, the issue is that you want to calculate the sum of a column, but including the selected ¨ Transportör ¨. Please try the following method and check if solve the problem:

1.Create the simple table.

vjiewumsft_0-1702545407792.png

vjiewumsft_1-1702545422619.png

2.Click on New measure on the Home tab.

vjiewumsft_2-1702545452814.png

 

3.Enter the following DAX formula. Move the Measure to the table visual.

 

Measure =
CALCULATE(
    SUM(Data[Förbrukning]),
    NOT Core[Transportör] IN { SELECTEDVALUE(Core[Transportör]) }
)

 

4.Move the Transportör to the slicer visual.

vjiewumsft_3-1702545527433.png

5.Select the Transportör and see the Measure. The result excludes the selected Transportör.

vjiewumsft_4-1702545553924.png

 

vjiewumsft_5-1702545570265.png

 

If the above ones can’t help you get it working, could you please provide more raw data(exclude sensitive data) with Text format and your expected result screenshotsIt would be helpful to find out the solution.

 

Looking forward to your reply.

Best Regards,

Wisdom Wu

 

 

 

 

View solution in original post

2 REPLIES 2
filip_u_s
Regular Visitor

Thanks Wisdom Wu.

That was just what I needed... 🙂

v-jiewu-msft
Community Support
Community Support

Hi @filip_u_s ,

If I understand correctly, the issue is that you want to calculate the sum of a column, but including the selected ¨ Transportör ¨. Please try the following method and check if solve the problem:

1.Create the simple table.

vjiewumsft_0-1702545407792.png

vjiewumsft_1-1702545422619.png

2.Click on New measure on the Home tab.

vjiewumsft_2-1702545452814.png

 

3.Enter the following DAX formula. Move the Measure to the table visual.

 

Measure =
CALCULATE(
    SUM(Data[Förbrukning]),
    NOT Core[Transportör] IN { SELECTEDVALUE(Core[Transportör]) }
)

 

4.Move the Transportör to the slicer visual.

vjiewumsft_3-1702545527433.png

5.Select the Transportör and see the Measure. The result excludes the selected Transportör.

vjiewumsft_4-1702545553924.png

 

vjiewumsft_5-1702545570265.png

 

If the above ones can’t help you get it working, could you please provide more raw data(exclude sensitive data) with Text format and your expected result screenshotsIt would be helpful to find out the solution.

 

Looking forward to your reply.

Best Regards,

Wisdom Wu

 

 

 

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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