Forum Discussion
Parameters in Power BI
I'm trying to display some data in card visuals, but it obvisously only lets me put one data column in at a time. I've been advised to create a parameter to combine the two columns but it doesn't seem to be working. Could someone explain, in simple terms, how I can do this so once the parameter is in the card visual, I can filter by either option.
ms166 , For Card visuals you can use a disconnected table with slicer values and use DAX to switch between the measures. Attached a sample PBIX with Switch Measure below.
Switch Measure = var _sales = SUM(financials[ Sales]) var _gross_sales = SUM(financials[Gross Sales]) RETURN SWITCH( TRUE(), SELECTEDVALUE('Table'[Slicer]) = "Sales",_sales, SELECTEDVALUE('Table'[Slicer]) = "Gross Sales",_gross_sales, _sales+_gross_sales)If I had answered your question, please accept this post as a solution.
Thanks,
Jai
1 Reply
- Jai-Rathinavel
Super User
ms166 , For Card visuals you can use a disconnected table with slicer values and use DAX to switch between the measures. Attached a sample PBIX with Switch Measure below.
Switch Measure = var _sales = SUM(financials[ Sales]) var _gross_sales = SUM(financials[Gross Sales]) RETURN SWITCH( TRUE(), SELECTEDVALUE('Table'[Slicer]) = "Sales",_sales, SELECTEDVALUE('Table'[Slicer]) = "Gross Sales",_gross_sales, _sales+_gross_sales)If I had answered your question, please accept this post as a solution.
Thanks,
Jai