Forum Discussion
How to compare between severals values in a simple table
- Anonymous2 years ago
Hi johnbasha33
Based on your needs, I have created the following table.
Then you can create a field parameter.
Put the created field parameters into the slicer.
Create the following two measures to compare the difference between Budget, R2, and realized and put them into the card visual.
Budget_realized = IF(SELECTEDVALUE(Parameter[Parameter Order])=0,SUM('Table'[Budget]) - SUM('Table'[realized]),BLANK())R2_realized = IF(SELECTEDVALUE(Parameter[Parameter Order])=1,SUM('Table'[R2]) - SUM('Table'[realized]),BLANK())Best Regards,
Jayleny
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
You can achieve this in Power BI using a single table and measures. Here's a general approach:
1. Create a table visualization with the sales numbers column.
2. Create a slicer visualization with the three different values (R2, Budget, Realized).
3. Create three measures to calculate the sales numbers based on the selected value in the slicer.
Here's an example of how you can create the measures:
```DAX
Sales R2 =
IF (
SELECTEDVALUE ( 'YourTable'[YourColumn] ) = "R2",
SUM ( 'YourTable'[Sales] ),
BLANK ()
)
Sales Budget =
IF (
SELECTEDVALUE ( 'YourTable'[YourColumn] ) = "Budget",
SUM ( 'YourTable'[Sales] ),
BLANK ()
)
Sales Realized =
IF (
SELECTEDVALUE ( 'YourTable'[YourColumn] ) = "Realized",
SUM ( 'YourTable'[Sales] ),
BLANK ()
)
```
Replace `'YourTable'` with the name of your table and `'YourColumn'` with the name of the column containing the three different values.
Once you have created these measures, add them to the card visualizations on your Power BI page. When you select a value in the slicer, the corresponding card will show the sales numbers based on the selected value.
Additionally, you can use conditional formatting on the card visuals to highlight the values based on your requirements.
This approach allows you to compare the sales numbers dynamically based on the selected value (R2, Budget, Realized) without duplicating the table.
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!
Hello johnbasha33
This IS where i am thank you to confirm myself in this solution to calculate the values.
Maybe i did not use the correct words i am sorry, when a talk about compare i need to calculate the difference between two values selected.
How Can i do this ?
The solution for now IS to load the table containing the values R2, budget, realized twice to make two slicers one for each tables
Thanks for your help.