Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
I have this field parameter
Switch = {
("Number", NAMEOF('Calculations'[ProductionLastMonth]), 0,"LastMonth",1),
("Value", NAMEOF('Calculations'[ValueProductionLastMonth]), 1,"LastMonth",1),
("Number", NAMEOF('Calculations'[ProductionCurrentMonth]), 2,"CurrentMonth",2),
("Value", NAMEOF('Calculations'[ValueProductionCurrentMonth]), 3,"CurrentMonth",2) }
I have a slicer with the Group Label.
Now I want to use it in a matrix.
On rows I have stores hierarchy, on values I use the switch parameter.
But when I put Group Label on columns (LastMonth, CurrentMonth) it doesn't work like I want.
When I select "LastMonth" or "CurrentMonth" , in the matrix it shows all four values instead of just two.
Also If I select both labels I still want to show just corresponding values for each of the labels, not all four for both.
I tried adding a disconected table with same values as Group Label, and use it in the slicer, but with no success.
Also tried with a measure to check if Group Label from Parameter is the same with Group Label from disconected table, but that doesn't seem to fix the issue.
Is there a way to fix this?
Solved! Go to Solution.
Hi @katemarkoska28 ,
Please check file attach with the switch statment and a column using the name for each one on the parameter table.,
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @katemarkoska28
I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.
Thank you.
Hi @katemarkoska28
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.
Thanks everyone for the replies, but it doesn't happen to solve the issue.
I've tried everything that you suggested. All the measures are in this file
I'm attaching a link to the sample dataset, since I don't have permissions to upload here.
FieldParameters Sample.pbix
Hi @katemarkoska28 ,
Please check file attach with the switch statment and a column using the name for each one on the parameter table.,
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsMay I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.
Hi @katemarkoska28
Please try the below DAX:
Selected Matrix Value :=
VAR SelectedGroupLabel = SELECTEDVALUE(GroupLabelSlicer[GroupLabel])
VAR SelectedOrder = SELECTEDVALUE('Switch'[Order])
RETURN
SWITCH(
TRUE(),
SelectedGroupLabel = "LastMonth" && SelectedOrder = 0, [ProductionLastMonth],
SelectedGroupLabel = "LastMonth" && SelectedOrder = 1, [ValueProductionLastMonth],
SelectedGroupLabel = "CurrentMonth" && SelectedOrder = 2, [ProductionCurrentMonth],
SelectedGroupLabel = "CurrentMonth" && SelectedOrder = 3, [ValueProductionCurrentMonth],
BLANK()
)
If this doesn’t fully meet your needs, could you kindly share a sample of your data and more detailed context? That would help us provide a more accurate solution.
Thank You!
Thank you for reaching out to the Microsoft Fabric Community Forum.
Regarding your query on using Field Parameters on columns in a matrix visual, this behavior is due to a known limitation of field parameters when used in matrix visuals, the selected fields from the parameter tend to display across all column groups, leading to undesired duplication.
As a workaround, you can consider creating a custom measure using a SWITCH statement that dynamically returns the appropriate measure based on a selected value from the parameter as suggested by @MFelix .
You can then place the Group Label on the matrix columns and use this Matrix Values measure in the Values section of the matrix.
Additionally, to improve control over what's displayed, you may also consider using a disconnected slicer table to filter based on the group label (LastMonth, CurrentMonth) and tie it back to your logic using a custom measure as mentioned by @DataNinja777
If this response resolves your query, kindly mark it as Accepted Solution to help other community members. A Kudos is also appreciated if you found the response helpful.
Thank You!
Hi @katemarkoska28 ,
The issue you're experiencing happens because the field parameter doesn't automatically filter based on external slicer selections, like your Group Label. Even if you use a disconnected slicer with the same labels (LastMonth, CurrentMonth), Power BI will still show all parameter values unless you explicitly filter them with a measure. To address this, keep your original field parameter table as it is:
Switch = {
("Number", NAMEOF('Calculations'[ProductionLastMonth]), 0, "LastMonth", 1),
("Value", NAMEOF('Calculations'[ValueProductionLastMonth]), 1, "LastMonth", 1),
("Number", NAMEOF('Calculations'[ProductionCurrentMonth]), 2, "CurrentMonth", 2),
("Value", NAMEOF('Calculations'[ValueProductionCurrentMonth]), 3, "CurrentMonth", 2)
}
Then, create a disconnected table to use in your slicer:
GroupLabelSlicer = DATATABLE("GroupLabel", STRING, {{"LastMonth"}, {"CurrentMonth"}})
Add this table to the slicer. Now, create a filter measure to dynamically match the slicer selection with the group label from your parameter table:
ShowSelectedGroupValues :=
VAR SelectedGroup = SELECTEDVALUE(GroupLabelSlicer[GroupLabel])
VAR ParamGroup = SELECTEDVALUE('Switch'[Group Label])
RETURN
IF(ParamGroup = SelectedGroup || ISBLANK(SelectedGroup), 1, 0)
Finally, drag this measure into the Filters pane of your matrix visual and set it to filter only when the value is 1. This will ensure that only the values from the selected group label (LastMonth or CurrentMonth) are shown in the matrix, and when both are selected, you’ll see only their corresponding parameter values, not all four.
Best regards,
I have tried this solution previously, but doesn't solve the issue.
Hi @katemarkoska28 ,
This is a limitation on the Field Parameters that when you use them in the matrix the values get multiplied by all columns.
The option is to create a switch measure to place on the values of the matrix something similar to:
Matrix Values=
Switch (
SELECTEDVALUE('Calculations'[Order]),
0, [ProductionLastMonth],
1,[ValueProductionLastMonth],
2, [ProductionCurrentMonth],
3,[ValueProductionCurrentMonth])
Then use the columns for the aggregation on the matrix.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsUser | Count |
---|---|
83 | |
75 | |
72 | |
42 | |
36 |
User | Count |
---|---|
114 | |
56 | |
52 | |
43 | |
42 |