0
votes

For a report in Power BI I have two column with name 'A' and 'B'. I want to show summation of values of column 'A' or 'B' in one card based on the selection of the user. I Want to know can I change column source of a card in report view in Power BI. A simple solution is to have two cards, each one for each column. But I want one card such that the user defines source column of it. Thanks

2

2 Answers

1
votes

First you have to see if you have any data that helps you to identify if column A or B is selected. If you havn't you can create an auxiliar table as I did to this solution like this:

enter image description here

Use this column to create a filter visualization

Then create the following DAX measure:

SUM = IF( SELECTEDVALUE( AuxTable[Auxiliar] ) = "A", SUM('Table'[A]), SUM('Table'[B] ) )

Don't forget to change the select options on your filter visualization to only be able to select 1 option if is necessary.

Hope it helps you.

0
votes

Another possible solution without using DAX is to take advantage of Buttons and Bookmarks.

In your scenario, you could create a Button corresponding to the possible use choices. When the user click on one button it will direct to the bookmark showing the visualization calculated using that data source.

In practice, this means you will have two Cards in your report, but only one visible at a time.