Forum Discussion
Power BI switch Data in visuals through button
- Anonymous2 years ago
Hi Anonymous ,
tharunkumarRTK Thanks for your reply!
Here is my sample data:I create three measures:
Then use Field-parameter:
And put the parameter into the table visual:
The final output is as below:
Best Regards,
Dino Tao
If this post helps, then please consider Accept both of the answers as the solution to help the other members find it more quickly. - Anonymous2 years ago
Hello, thank you for your answers. So, both of your options work. But I did it this way:
Choices = IF ( SELECTEDVALUE(Choice[Button]) = "Gross", [Gross], IF(SELECTEDVALUE(Choice[Button]) = "Net", [Net], IF(SELECTEDVALUE(Choice[Button]) = "Profit", [Profit])))This worked fine for me.Now, I have another question.I need to calculate values based on the year that is highlighted through a slicer. I need a formula that calculates the values of the last year based o nthe year that is selected. I did that through this:Last_year_values =VAR SelectedMetrik = SELECTEDVALUE(Choice[Button])VAR CurrentYear = YEAR(MAX(Dates[Date]))VAR LastYear = CurrentYear - 1RETURNCALCULATE (SWITCH (SelectedMetrik,"Gross", [Gross],"Net", [Net],"Profit", [Profit]),FILTER ( ALL(Dates), YEAR(Dates[Date]) = LastYear ))That workes just fine. However, if I select a specific month of the current year, it is supposed to calculate last years values only for that selected month. But I fail in achieving this. Could you help me with that too? 🙂
Anonymous
Create three measures, Gross, Net and Profit and create Field parameter for switching the measure in the visual.
You can refer this document for detailed explanation: https://learn.microsoft.com/en-us/power-bi/create-reports/power-bi-field-parameters
If the post helps please give a thumbs up
If it solves your issue, please accept it as the solution to help the other members find it more quickly.
Tharun