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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Apply calculation to fact table measure using a condition in dimension table

I have a dimension table with hard drive information. Some of the drive skus are bundles of 6 units, but the fact table only recognizes it as 1 unit. I need to multiple all the bundle units by 6.

 

Here is my logic:

 

IF('Dim Hard Drives'[Bundle] = "Bundle", 'Fact Sales' [Quantity] = [Quantity] * 6, [Quantity] * 1)

 

I am aware that the IF statement is not the correct route to go, but I am new to DAX so I am unsure which route to go. 

1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

Here is an expression you can try to get the adjusted quantity. 

 

Adjusted Quantity =
SUMX (
    'Dim Hard Drives',
    IF (
        'Dim Hard Drives'[Bundle] = "Bundle",
        CALCULATE ( SUM ( 'Fact Sales'[Quantity] ) ) * 6,
        CALCULATE ( SUM ( 'Fact Sales'[Quantity] ) )
    )
)

 

If that ends up calculating slowly, you can speed it up by adding a calculated column first with Multiplier = IF('Dim Hard Drives'[Bundle] = "Bundle", 6, 1), and then using this measure

 

Adjusted Quantity =
SUMX (
'Dim Hard Drives',
'Dim Hard Drive'[Multiplier] * CALCULATE ( SUM ( 'Fact Sales'[Quantity] ) )
)

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , You need to create a new column like this in fact, but you need to bring data by joining key column 'Dim Hard Drives' and 'Fact Sales', I assumed it as Item

 

 

new column =
var _1= Max(filter('Dim Hard Drives', 'Dim Hard Drives',[Item] ='Fact Sales'[Item]),'Dim Hard Drives'[Bundle])

return
if(_1= "Bundle", [Quantity] * 6, [Quantity] * 1)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
mahoneypat
Microsoft Employee
Microsoft Employee

Here is an expression you can try to get the adjusted quantity. 

 

Adjusted Quantity =
SUMX (
    'Dim Hard Drives',
    IF (
        'Dim Hard Drives'[Bundle] = "Bundle",
        CALCULATE ( SUM ( 'Fact Sales'[Quantity] ) ) * 6,
        CALCULATE ( SUM ( 'Fact Sales'[Quantity] ) )
    )
)

 

If that ends up calculating slowly, you can speed it up by adding a calculated column first with Multiplier = IF('Dim Hard Drives'[Bundle] = "Bundle", 6, 1), and then using this measure

 

Adjusted Quantity =
SUMX (
'Dim Hard Drives',
'Dim Hard Drive'[Multiplier] * CALCULATE ( SUM ( 'Fact Sales'[Quantity] ) )
)

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

Brilliant, I guess I was on the right track just needed some tweaking. Thank you!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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