Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Multiple SELECTEDVALUES conflicting for dynamic MoM Change

It's probably easiest to explain this by starting with an image first

What I'm tryin to do is have each one of these lead counts filter to the selected value of the month above them, which are currently set up in 3 separate datedim tables. Then what I'm trying to do is use those calculations to get the % change in the card visual on the far right. 

My Lead Count cards are presently using variations of this measure and the output what I need:

Lead Count = 
var monthtouse = SELECTEDVALUE(TableDateDim[MonthAbbrvAndYearName])
var maxdate = calculate(max(AlternateDateDim1[DateSK]),AlternateDateDim1[MonthAbbrvAndYearName] = monthtouse)
var mindate = calculate(min(AlternateDateDim1[DateSK]),AlternateDateDim1[MonthAbbrvAndYearName] = monthtouse)
var leadcount = calculate(DISTINCTCOUNT(Table[IdentifierDim]),Table[CreateDtID] >= mindate,Table[CreateDtID] <= maxdate)
return leadcount

 The issue I've run into that I cannot figure out a solve for is the card for the MoM Change will not work without allowing interactions with the slicers but the second I allow both slicers to interact with the card they conflict and the card outputs (blank). Currently the measure I'm using is very simple but apparently won't work like I had hoped

Leads MoM Change = 
var leadsrecent = [Lead Count]
var leadsother = [Lead Count2]
var output = divide(leadsrecent-leadsother,leadsother)
return output


Is there some creative way to get to my end that I just haven't thought of or seen before? I'm about at my wits end.

  • 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 leadcount

     

     

     

    The 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.

7 Replies

  • Hi,

    Why do you need 4 drop downs?  Why 4 date tables?  Try this:

    1. Create a Calendar Table and build a relationship from the Date column of your data table to the Date column of your Calendar Table
    2. In the Calendar Table, write calculated field formulas to extract Year, Month Name and Month number.  Sort the Month Name by the Month number
    3. To your visuals/slicers, drag Year/Month from the Calendar Table.  Select the Year as 2020 and Month as August
    4. 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])

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      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_Mathur's avatar
        Ashish_Mathur
        Icon for Super User rankSuper 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.

  • v-zhenbw-msft's avatar
    v-zhenbw-msft
    Icon for Community Support rankCommunity Support

    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 leadcount

     

     

     

    The 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.

  • v-zhenbw-msft's avatar
    v-zhenbw-msft
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

     

    How about the result after you follow the suggestions mentioned in my original post?

    Could you please provide more details or expected result about it If it doesn't meet your requirement?

    If you've fixed the issue on your own please kindly share your solution. If the above posts help, please kindly mark it as a solution to help others find it more quickly.

     

    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.