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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Anonymous
Not applicable

## Slicer on just one quarter of data

Hi,

I have information such as

Group Name      Column A         Column B        Quarter

ABC                      100                     200               2020Q1

ABC                       200                    300               2020Q2

DEF                        100                    200               2020Q1

DEF                         100                    600               2020Q2

I want my slicer on Column B with just one quarter selection which means

if the slicer is set as 301, the flag should set as 0

I have built my slicer on Column A which is on 2020Q2 - 2020Q1 so it gives out 100

Basically, my data should look like

Group Name       Column A             Column B

ABC                      100                         300

DEF                        0                            600

& in slicer on Column B is set as >300 there should be just DEF  0 600 displayed.

1 ACCEPTED SOLUTION
Community Support

Hi @Anonymous ,

Create a measure as below and add it to visual filter.

``````Measure =
var _previous = CALCULATE(SUM('Table'[Column A]),FILTER(ALL('Table'),'Table'[Group]=SELECTEDVALUE('Table'[Group])&&RIGHT('Table'[Quarter],1)+0=RIGHT(SELECTEDVALUE('Table'[Quarter]),1)-1))
var _subtraction = IF(ISBLANK(_previous),BLANK(),SELECTEDVALUE('Table'[Column A])-_previous)
var _max = CALCULATE(MAX('Table'[Column B]),ALLEXCEPT('Table','Table'[Group]))
return
IF(_subtraction>SELECTEDVALUE(slicer1[slicer1])&&_max>SELECTEDVALUE(slicer2[slicer2]),1,0)``````

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
3 REPLIES 3
Community Support

Hi @Anonymous ,

Create a measure as below and add it to visual filter.

``````Measure =
var _previous = CALCULATE(SUM('Table'[Column A]),FILTER(ALL('Table'),'Table'[Group]=SELECTEDVALUE('Table'[Group])&&RIGHT('Table'[Quarter],1)+0=RIGHT(SELECTEDVALUE('Table'[Quarter]),1)-1))
var _subtraction = IF(ISBLANK(_previous),BLANK(),SELECTEDVALUE('Table'[Column A])-_previous)
var _max = CALCULATE(MAX('Table'[Column B]),ALLEXCEPT('Table','Table'[Group]))
return
IF(_subtraction>SELECTEDVALUE(slicer1[slicer1])&&_max>SELECTEDVALUE(slicer2[slicer2]),1,0)``````

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
Super User

@Anonymous , need a little bit more clarity on what you need, getting lost into the description

Anonymous
Not applicable

I have two files. One for 2020 Q1 and one for 2020 Q2.

First file has records:

Group Name      Column A         Column B        Quarter

ABC                      100                     200               2020Q1

ABC                       200                    300               2020Q2

Second file has records:

DEF                        100                    200               2020Q1

DEF                         100                    600               2020Q2

When i combine both the files, the data looks like

Group Name      Column A         Column B        Quarter

ABC                      100                     200               2020Q1

ABC                       200                    300               2020Q2

DEF                        100                    200               2020Q1

DEF                         100                    600               2020Q2

Now i want two slicers on this.

First slicer on Column A which is based on group name and subtraction of the previous quarter from second quarter

Second slicer on Column B which is grouped by group name and just simply takes the max quarter value, in this case it is 2020 Q2 which is 300.

So the values for group ABC

looks like

ABC      (200-100)      300

DEF       (100-100)      600

So if i select slicer 1 as > 99 and slicer 2 as > 299, i only see one row which is

ABC     100     300

I have done the first part is on Slicer 1. For slicer 2 , i tried restricting the data to only quarter 2 on the entire page, however then the calculations go wrong for slicer 1 since first quarter data is not available.

## Helpful resources

Announcements

#### New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

#### Power BI Monthly Update - May 2024

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

#### Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors