Forum Discussion
Crete measure for multiple columns
- 4 years ago
Hi Saxon10
I have a solution but it is not the most dynamic. If your column headers will never change then this may be a fine solution but I'm sure someone may have a more dynamic option. However, please see the below measure and let me know if this is a viable option.
CheckQty = SWITCH(TRUE(), CONTAINSSTRING("Qty Need 10 Days",MAX('Days'[Days])),SUM('Items'[Qty Need 10 Days]), CONTAINSSTRING("Qty Need 20 Days",MAX('Days'[Days])),SUM('Items'[Qty Need 20 Days]), CONTAINSSTRING("Qty Need 30 Days",MAX('Days'[Days])),SUM('Items'[Qty Need 30 Days]), CONTAINSSTRING("Qty Need 40 Days",MAX('Days'[Days])),SUM('Items'[Qty Need 40 Days])) + 0Result:
Kind regards,
Seanan
If this post helped, please consider accepting it as the solution. - 4 years ago
Hi Saxon10
You could try this:
Total = 'Items'[10 Days] + 'Items'[20 Days] + 'Items'[30 Days] + 'Items'[40 Days]Then click on the parameter column and adjust the code to:
Days = { ("10Days", NAMEOF('Items'[10 Days]), 0), ("20 Days", NAMEOF('Items'[20 Days]), 1), ("30 Days", NAMEOF('Items'[30 Days]), 2), ("40 Days", NAMEOF('Items'[40 Days]), 3), ("Total", NAMEOF('Items'[Total]), 4) }Result:
- 4 years ago
Hi Saxon10 ,
For the card create the following measure:
Measure = VAR __SelectedValue = SELECTCOLUMNS ( SUMMARIZE ( days , Days[Days] , Days[Days Fields]), Days[Days] ) var SelectedValuesDays = CONCATENATEX(__SelectedValue, Days[Days], "|") Return IF(CONTAINSSTRING(SelectedValuesDays, "10"), [10 days]) + IF( CONTAINSSTRING(SelectedValuesDays, "20"), [20 days]) + IF( CONTAINSSTRING(SelectedValuesDays, "30"), [30 days]) + IF( CONTAINSSTRING(SelectedValuesDays, "40"), [40 days])
MFelix, Thanks for your response.
Some reason it's not working properly.
Example :
If I select 30 days then value not changing its showing 20 days value instead off 30 days. Please refer the snap shot of the error.
My expectation is if I select 10 days then it will show only 10 days sum of qty the same thing for 20, 30 and 40 days.
On the card you need to use the column from the parameter field you used, since it's a card will present the first one selected on the slicer.
- Saxon104 years agoPost Prodigy
I don't have parameters new field option like you have it.
(Highlights in red colour) I don't have any drop down option at my end in order to choose/add the field option.
Is there any setting need to be enabled? Can you please share the step by step article so I can get the same option.
Even I can't see the option your work file.
How can I add the parameter in card. I am really struggling and its confusing for me.
@Seanan option working only first selection and when I try to choose different days in slicer then sum of qty is blanks.
I got the parameter option at my end(Please refer the snapshot)
Is there any alternative way I can achieve the desired results.
Could you please advise.
Much appreciated your effort and time.
Thank you
- Seanan4 years agoSolution Supplier
Hi Saxon10
You can enable field parameters by clicking File -> Options and Settings -> Options -> Preview Features -> Tick field parameter (Thanks @MFelix for showing me this)
- MFelix4 years agoSuper User
Just adding to this
https://docs.microsoft.com/en-us/power-bi/create-reports/power-bi-field-parameters