Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
danb
Resolver I
Resolver I

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
1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
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:

8.JPG

 

here is pbix file, please try it.

 

Best Regards,

Lin

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

View solution in original post

2 REPLIES 2
v-lili6-msft
Community Support
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:

8.JPG

 

here is pbix file, please try it.

 

Best Regards,

Lin

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

@v-lili6-msft - this works perfectly! Many thanks!

 

Dan

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.