cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
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
v-jayw-msft
Community Support
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)

0.PNG

 

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.

View solution in original post

3 REPLIES 3
v-jayw-msft
Community Support
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)

0.PNG

 

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.
amitchandak
Super User
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
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors