For demonstration purposes, I have created two sample tables.
- Sales
- Role
Below is the Power Query for both tables.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("hZVBTsMwEEWvgroukmfsOPYFWLBFrEoXEXTBpkKQ+6shjeMf8ydUldpK7yeemTfp6XRw8ji91Uk+HA+v18/x8vHwMg7j5Wf6LZ2bXtOXPH+ej3debd4vvCLvbT4ufEA+2Hxe+Ih8Z/KhnCchH01e+zsvblNwbwZESmBTcbIDWgKbkrMd8CXgtQbE2YGwHilAwB7yPOU5IBEC9pQlrl1KUMPvHdTRAG+r2oG0zC1r45HBFy9SaDzivBav+9h4ZPBSvGsLnjv0Nj4PX8MVDTI2BsiijrErSOruliDpd/cDyX53M5BM+zuBaN7fBuyTYzVlRgqpqfqPtw+kJmFTqspjTULHFGlNq+ykp81uK0G79aqeGo5obSqVG9CwPiuEek08JTu8dODpe7i+XzZWWU4DWrSypAY0MQMCRTMZLGpd0eJVY2ukl43ssP1eXbbZleV/apmi7P8M3f6nB0LnxXsgdGBKn0JgN5wgsLqUoh17DnmGdnS2gaFVb9d68Idt/T7fAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, Country = _t, Revenue = _t, #"Cost of Sales" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Country", type text}, {"Revenue", Int64.Type}, {"Cost of Sales", Int64.Type}})
in
#"Changed Type"
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WKi1OLTJ0SM1NzMzRS87PVdJRCs3LLElNUQguSSxJLVaK1YGoMUJR45VYkJgHlzNGkXMrSsxLToVLmqBIOubkKMXGAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Username = _t, Country = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Username", type text}, {"Country", type text}}),
#"Trimmed Text" = Table.TransformColumns(#"Changed Type",{{"Country", Text.Trim, type text}})
in
#"Trimmed Text"
These country names will be the page names in our report. We have to show only the default page(Home).
Also, I have created two measures.
PageNavigation =
var _role= CALCULATE(SELECTEDVALUE(Role[Country]),FILTER(Role,Role[Username]=USERPRINCIPALNAME()))
return _role
Once the user login to the service, This PageNavigation measure will return the corresponding country name.
We can use this measure in the button Action destination field.
RoleSpecificText =
var _role= CALCULATE(SELECTEDVALUE(Role[Country]),FILTER(Role,Role[Username]=USERPRINCIPALNAME()))
var _result= SWITCH(_role,"All","Detailed View","My View")
return _result
Once the user login to the service, this RoleSpecificText measure will return the dynamic button text value.
We can use this measure in the button text field.
Let’s see how it is working. 😎
Below is the view of User1.
You can find the button text is “My View” (top right). When User1 clicks on My view, he will see United States data.
Below is the view of User4.
Now, the button text is “Detailed View”. When User4 clicks on Detailed View, he will see detailed views of all country data.
I have attached the pbix file for your reference. Try this feature and share your comments.
Thank you 🙂
——————————————————————————————————————————————
Be the first to comment