Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

SelectedValues function not displaying values for all userid

Hello,

 

I am using the below DAX calculation as a measure in Table visual.

 

PreviousMonth =
Var YT = CALCULATE(SELECTEDVALUE(FACT_ABCD_VW[USER_ID]),FILTER(ALL(DIM_DATE_VW),DIM_DATE_VW[YEAR]=SELECTEDVALUE(DIM_DATE_VW[YEAR]) && DIM_DATE_VW[MONTH]<=SELECTEDVALUE(DIM_DATE_VW[MONTH])))
RETURN YT
 

 

In this formula, there are 6 user ids which are getting skipped, i.e. they do not appear in details report. Instead of this formula, if I user the measure directly from Fact Table, it works normally. Any idea why is this happening.

 

We need a definitive solution for this, any help will be very useful.

 

Thanks in advnace.

 

Swapneel Kale

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi  Anonymous ,

     

    I created some data:

    Are you referring to the current year and current month in table DIM_DATE_VW, showing the collection corresponding to table FACT_ABCD_VW[USER_ID]?

     

    Here are the steps you can follow:

    1. Create measure.

    Measure =
    CONCATENATEX(
        FILTER(ALL(FACT_ABCD_VW),
        YEAR('FACT_ABCD_VW'[Date])=YEAR(MAX('DIM_DATE_VW'[Date]))&&
        MONTH('FACT_ABCD_VW'[Date])<=MONTH(MAX('DIM_DATE_VW'[Date]))),'FACT_ABCD_VW'[USER_ID],"-")

    2. Result:

    If it doesn't meet your desired outcome, can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

5 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  Anonymous ,

     

    I created some data:

    Are you referring to the current year and current month in table DIM_DATE_VW, showing the collection corresponding to table FACT_ABCD_VW[USER_ID]?

     

    Here are the steps you can follow:

    1. Create measure.

    Measure =
    CONCATENATEX(
        FILTER(ALL(FACT_ABCD_VW),
        YEAR('FACT_ABCD_VW'[Date])=YEAR(MAX('DIM_DATE_VW'[Date]))&&
        MONTH('FACT_ABCD_VW'[Date])<=MONTH(MAX('DIM_DATE_VW'[Date]))),'FACT_ABCD_VW'[USER_ID],"-")

    2. Result:

    If it doesn't meet your desired outcome, can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks, will try and get back on same

  • you tried using MAX instead of SELECTEDVALUE?

    MAX(FACT_ABCD_VW[USER_ID])

    MAX(DIM_DATE_VW[YEAR])

    MAX(DIM_DATE_VW[MONTH])

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi, TOTALYTD is not displaying all the records in details visual, hence I had to do YTD calculation manually.