Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Multiplicaiton: Dax code with filters, how to write code for a new column?
test = Weight1 * weight2 * Adj ................filter by customer, filter by material, filter by channel (and maybe another filter as well)
or IF statement if that would work better? Unless there is something better, I am still learning all these DAX codes.
Thank you!
Solved! Go to Solution.
Hi @yaya1974 - can you try below one.
Hope it works.
Proud to be a Super User! | |
Hi @yaya1974 - Create calculated column using if and in your table
FilteredProduct =
IF (
AND (
'SalesData'[CustomerID] = "CustomerA", -- Replace with your filter criteria
'SalesData'[MaterialID] = "MaterialX", -- Replace with your filter criteria
'SalesData'[ChannelID] = "ChannelY" -- Replace with your filter criteria
),
'SalesData'[Weight1] * 'SalesData'[Weight2] * 'SalesData'[Adj],
BLANK() -- Returns blank if the filter criteria are not met
)
for better you can also try with switch statement
Hope it helps
Proud to be a Super User! | |
Thank you! As soon as I add the coma after the Material I get syntax error. any idea why?
Also I am not familar with Switch.
Hi @yaya1974 - can you try below one.
Hope it works.
Proud to be a Super User! | |
Thank you!!
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 47 | |
| 43 | |
| 39 | |
| 20 | |
| 15 |
| User | Count |
|---|---|
| 68 | |
| 68 | |
| 31 | |
| 27 | |
| 24 |