The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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.
Solved! Go to Solution.
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
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
@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)
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
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Brilliant, I guess I was on the right track just needed some tweaking. Thank you!
User | Count |
---|---|
17 | |
8 | |
7 | |
6 | |
6 |
User | Count |
---|---|
26 | |
13 | |
12 | |
9 | |
8 |