Forum Discussion

danb's avatar
danb
Resolver I
7 years ago
Solved

Including Widgets based on 2 parameters based on year

Hello Experts, 

I have an issue that I am a bit at a loss on how to solve. I have a table with sales data in it by month. The table will have anywhere between 13 and 24 months depending on today's date. What I am looking to do is identify which widgets meet the following criteria:

1. Had sales in all 12 months in 2018

2. Have sales in all complete months so far in 2019 

 

What I am trying to do is identify which widgets meet these two criteria and then I will include them in an additional analysis and suppress everything that does not meet both criteria. I have included a table as a mock up for you to play around with. 

 

The answer should be only "A" and "F" should be included as meeting both criteria. 

 

Thank you in advance! 

 

WidgetDateQuantity
A1/1/20181
A2/1/20183
A3/1/20185
A4/1/20185
A5/1/20186
A6/1/20184
A7/1/20181
A8/1/20184
A9/1/20189
A10/1/20189
A11/1/20184
A12/1/201810
A1/1/201910
A2/1/201910
A3/1/20196
A4/1/20192
B1/1/201910
B2/1/20196
B3/1/20195
B4/1/20194
C1/1/20181
C2/1/20186
C3/1/20182
C4/1/20186
C5/1/20183
C6/1/20189
C7/1/20182
C8/1/20188
C9/1/20188
C10/1/20189
C11/1/20185
C12/1/20183
D2/1/20184
D3/1/20185
D4/1/20182
D5/1/20183
D6/1/20181
D7/1/20183
D8/1/20182
D9/1/20185
D10/1/20181
D11/1/20181
D12/1/20183
D1/1/201910
D2/1/20194
D3/1/201910
D4/1/20195
E1/1/20183
E2/1/20185
E3/1/20185
E4/1/20182
E5/1/20185
E6/1/201810
E7/1/20187
E8/1/20189
E9/1/20189
E10/1/20186
E11/1/20189
E12/1/20189
E1/1/20196
E2/1/201910
F1/1/20181
F2/1/20184
F3/1/20183
F4/1/20186
F5/1/20185
F6/1/20182
F7/1/20187
F8/1/20189
F9/1/201810
F10/1/20183
F11/1/20185
F12/1/20186
F1/1/20199
F2/1/20198
F3/1/20191
F4/1/20199
  • hi, danb 

    You could try this way:

    Step1:

    Add a year column and a month column for Date

    Step2:

    Use this formula to create a measure

    Measure = 
    IF (
        CALCULATE ( COUNTA ( Table1[Month] ), FILTER ( Table1, Table1[Year] = 2018 ) ) = 12
            && CALCULATE (
                COUNTA ( Table1[Month] ),
                FILTER ( Table1, Table1[Year] = 2019 && Table1[Month] < MONTH ( TODAY () ) )
            )
                = MONTH ( TODAY () ) - 1,
        1
    )

    Step3:

    Drag Widget column and this measure into a table visual

    or just drag Widget column  into a table visual and drag this measure into  visual level filter and set is not blank.

    Result:

     

    here is pbix file, please try it.

     

    Best Regards,

    Lin

2 Replies

  • v-lili6-msft's avatar
    v-lili6-msft
    Community Support

    hi, danb 

    You could try this way:

    Step1:

    Add a year column and a month column for Date

    Step2:

    Use this formula to create a measure

    Measure = 
    IF (
        CALCULATE ( COUNTA ( Table1[Month] ), FILTER ( Table1, Table1[Year] = 2018 ) ) = 12
            && CALCULATE (
                COUNTA ( Table1[Month] ),
                FILTER ( Table1, Table1[Year] = 2019 && Table1[Month] < MONTH ( TODAY () ) )
            )
                = MONTH ( TODAY () ) - 1,
        1
    )

    Step3:

    Drag Widget column and this measure into a table visual

    or just drag Widget column  into a table visual and drag this measure into  visual level filter and set is not blank.

    Result:

     

    here is pbix file, please try it.

     

    Best Regards,

    Lin