Forum Discussion
Multiple SELECTEDVALUES conflicting for dynamic MoM Change
- 6 years ago
Hi Anonymous ,
SELECTEDVALUES doesn’t support multiple values. So you can use VAUES function.
The lead count measure as following,
New lead count = var monthtouse = VALUES(AlternateDateDim1[MonthAbbrvAndYearName]) var maxdate = calculate(max(AlternateDateDim1[DateSK]),AlternateDateDim1[MonthAbbrvAndYearName] in monthtouse) var mindate = calculate(min(AlternateDateDim1[DateSK]),AlternateDateDim1[MonthAbbrvAndYearName] in monthtouse) var leadcount = calculate(DISTINCTCOUNT(Data[Identifier]),Data[CreateDtID] >= mindate,Data[CreateDtID] <= maxdate,USERELATIONSHIP(AlternateDateDim1[DateSK],Data[CreateDtID])) return leadcountThe reason why MoM displays blank is the interactions. Please check the interactions between slicers and card visuals.
The following is the result of our change interaction, is it what you want?
If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
BTW, pbix as attached.
Hi,
Why do you need 4 drop downs? Why 4 date tables? Try this:
- Create a Calendar Table and build a relationship from the Date column of your data table to the Date column of your Calendar Table
- In the Calendar Table, write calculated field formulas to extract Year, Month Name and Month number. Sort the Month Name by the Month number
- To your visuals/slicers, drag Year/Month from the Calendar Table. Select the Year as 2020 and Month as August
- Write these measures
Lead count =
DISTINCTCOUNT(Table[IdentifierDim])
Lead count in previous month
calculate([lead count],previousmonth(calendar[date]))
Lead count in previous month
calculate([lead count],sameperiodlastyear(calendar[date]))
Growth in lead count over previous month (%)
divide(([lead count]-[lead count in previous month]),[lead count in previous month])
Growth in lead count over same period last year (%)
divide(([lead count]-[lead count in same period last year]),[lead count in same period last year])
Ashish_Mathur I have a calendar table with every possible calendar field you could want, trust me, and I already had a relationship tied between the data table and the date table. I also initially only had the 1 date table but I tried creating the additional ones as a hail mary to solve the problem but it's not the date tables causing my problem.
I've got the page set up to look like its 'This month' compared to 'last month' but I would like to be able to compare months at will, hence the use of the selectedvalue() function with the months in the slicers. Without the desire to be able to compare months at will, I probably would have done exactly what you suggested. If I absolutely have to hard code then I'll hard code, but I would prefer a complex or creative solution if it enables flexibility in the end.
- Ashish_Mathur6 years agoSuper User
Hi,
In that case, you will have to create inactive relationships between your base dataset and other calendar tables and then use the USERELATIONSHIP() function to compare months of your choice.
- Anonymous6 years agoNot applicable
Ashish_Mathur I had tried both active and inactive relationships with those tables. I just tried including USERELATIONSHIP() and that also doesn't seem to be getting things to work as I would like them to. Either something is just eluding me or that also is not a solution to the problem. I've uploaded a trimmed down version of my .pbix file that should include the necessary tables, fields, and measures in case that is helpful.
https://www.dropbox.com/s/jn0wfd1qokk5mfu/CSC%20Dash2.pbix?dl=0
- Ashish_Mathur6 years agoSuper User
Hi,
In the image, you can see that the cards where the filter criteria is August 2020 are working fine. Create the AlternateDateDim tables the same as the DateDim table and create the same relationship that i have. Then write three measures (the way i have create the "Measure" measure).
Hope this helps.
You may download the PBI file from here.
Hope this helps.