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? 🙂
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.