Forum Discussion
Calculate Value with a measured quantity based on different types
I have the Matrix working as expected.
I would like to add card visuals that show just the totals. When I use the "measure" I created outside of the table - it calculates an incorrect value.
How can I create a card visual that shows just the total.
Formulat would be like:
Option E Total = (shortage type A * cost type A for Option E) + (shortage type B * cost type B for Option E) + (...)
See "table 2" above that has the family and option costs.
To create a card visual that shows the total for each option, you can create separate measures for each option and then sum them up for the card visual. Assuming you have measures like Option_E, Option_A, and Option_P, you can create total measures for each option and then use them in the card visual.
Here's an example for Option E:
Option_E_Total =
CALCULATE(
SUMX(
VALUES(Table1[Customer Name], Table1[Product Size]),
[Option_E]
)
)
This measure calculates the sum of the Option_E measure for each unique combination of "Customer Name" and "Product Size." You can create similar measures for Option A and Option P:
Option_A_Total =
CALCULATE(
SUMX(
VALUES(Table1[Customer Name], Table1[Product Size]),
[Option_A]
)
)
Option_P_Total =
CALCULATE(
SUMX(
VALUES(Table1[Customer Name], Table1[Product Size]),
[Option_P]
)
)
Now, you can use these total measures in your card visuals:
- Drag the Option_E_Total measure to a card visual to display the total for Option E.
- Similarly, use Option_A_Total and Option_P_Total for Option A and Option P.
This approach ensures that you're correctly summing up the individual option values for each unique combination of "Customer Name" and "Product Size" in your dataset. Adjust the column and table names based on your actual data model.
- awarriorpoet2 years ago
Helper I
Thank you as always for your quick response. I am getting an error when using the VALUES() command you recommended. It will only accept 1 argument. Not sure how to fix it to get intended outcome.