Forum Discussion

Marico's avatar
Marico
Helper IV
1 year ago
Solved

Combining matrix

Hi,   I have the following requirements from the user not sure how many of them are possible.   Model Structure: Source and Target data are coming from two different database tables. There is a ...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi Marico ,

     

    According to your description, you want to display the data of the current month and the previous five months, and users can use slicer to change the columns in the matrix. Currently, the built-in slicer does not support the default option. I recommend that you use the preselected slicer. The following is my test for your reference. Since I don't know how your year-end target column is obtained, I only display the data up to the current month.

    Step1. Add preselected slicer. 

    Step2. Custom table and Measure.

    _PreselectedSlicer = DATATABLE(
        "IsDirtySlicer", BOOLEAN, 
        {
            {FALSE()},
            {TRUE()}
        }
    )
    Measure 2 = 
    VAR _select_date = SELECTEDVALUE('Date'[Month-Year])
    VAR _previous =UNION(SELECTCOLUMNS(GENERATESERIES(0,5,1),"test",FORMAT(EDATE(TODAY(),-[Value]),"YYYY-MMM")),ROW("test","CurrentYear"))
    RETURN
        IF(_select_date IN _previous,TRUE(),FALSE())

    Step3. The Matrix.

     

    Buttons of preselected slicer.

     

     

     

     

     

    Best regards,

    Mengmeng Li