Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Slicer help!

Hello, I have created on Power BI a matrix visual showcasing by campaigns, the number of orders that happened between 0 to 30 days from seeing an ad to an actual purchase (please see screenshot below...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Thanks for the reply from foodd  please allow me to provide another insight:

    Hi, Anonymous 

    Regarding the issue you raised, my solution is as follows:

    1.First I have created the following table and the column names and data are the data you have given:

    2.Generate a custom column to change its data type to an integer:

    textText.Start([DAYS],2)

    3.To create a calculated table as a slicer:

    slicer = GENERATESERIES(0,30,1)
    

    4. Below are the measure I've created for your needs:

    MEASURE =
    VAR select1 =
        SELECTEDVALUE ( 'slicer'[Value] )
    RETURN
        SWITCH (
            TRUE (),
            select1 <= 2, CALCULATE ( SUM ( 'purchase'[values] ), 'purchase'[Custom] <= 2 ),
            select1 <= 5, CALCULATE ( SUM ( 'purchase'[values] ), 'purchase'[Custom] < 10 ),
            select1 <= 10, CALCULATE ( SUM ( 'purchase'[values] ), 'purchase'[Custom] < 15 ),
            select1 <= 15, CALCULATE ( SUM ( 'purchase'[values] ), 'purchase'[Custom] < 20 ),
            select1 <= 20, CALCULATE ( SUM ( 'purchase'[values] ), 'purchase'[Custom] < 25 ),
            select1 <= 25, CALCULATE ( SUM ( 'purchase'[values] ), 'purchase'[Custom] < 30 ),
            SUM ( 'purchase'[values] )
        )
    

    5.Modify the visualization setting:

     

     

     

    6.Here's my final result, which I hope meets your requirements.

     

    Please find the attached pbix relevant to the case.

     

    Best Regards,

    Leroy Lu

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