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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Filter to populate one line on the graph

Hi

Can someone please help

I wanted to test 2 conditions 

lets say we have a line graph, when condition 1 period & personnel is selected, it will populate one line on the graph, when condition 2 is selected, it will populated another line on the graph. So we can compare the value column in these 2 conditions.

 

so we would want to duplicate the filters to have 2 sets of filter ( condition 1 ( period and personnel ) and condition 2 period and personnel)

 

thanksCapture.PNG

 

 
 

 

Condition PeriodCondition PersonnelValue
Jan-21AA175
Feb-21BB376
Mar-21CC235
Apr-21DD274
May-21EE471
Jun-21FF154
Jul-21GG159
Aug-21KK229
Sep-21LL285
Oct-21MM441
Nov-21NN265
Dec-21OO404
Jan-22PP387
Feb-22QQ316
Mar-22RR413
Apr-22SS139
May-22TT440
Jun-22UU306
Jul-22VV249
Aug-22WW416
Sep-22XX424
Oct-22YY140
Nov-22ZZ413
Dec-22AS230
Jan-23AF429
Feb-23ER138
Mar-23FS485
Apr-23TE266
May-23JF330
Jun-23DJ426
Jul-23DT341
Aug-23WB260
Sep-23CJ127
Oct-23VY405
Nov-23FJ443
9 REPLIES 9
MFelix
Super User
Super User

Hi  @Anonymous ,

 

What are the conditions you want to test? Without knowing the conditions is difficult to give you an answer, bvut this passes for making use of two measures and a slicer look at the video below with a similar explanation for tuining on and off measures on a chart.

 

https://community.powerbi.com/t5/Webinars-and-Video-Gallery/Turn-Measures-On-and-Off-Inside-a-Chart-with-CONTAINS/td-p/151045

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Anonymous
Not applicable

Hi 

 

By conditions I mean ( any values within the column Period and Personnel) .

 

So we should have 2 groups of filter,

 

first group ( period and personnel) , second group ( period and personnel again)

 

so a user can select any value from Period and Personnel in the first group as scenior 1 and then select another value for period and personnel (second group) at the same time to compare

Hi @Anonymous ,

 

You need to create to tables for the slicers then just add the following measures:

 

Slicer 1 Calculation =
CALCULATE (
    SUM ( 'Table'[Value] );
    FILTER (
        'Table';
        'Table'[Condition Period] IN VALUES ( 'Slicer 1'[Condition Period] )
            && 'Table'[Condition Personnel] IN VALUES ( 'Slicer 1'[Condition Personnel] )
    )
)

Slicer 2 Calculation =
CALCULATE (
    SUM ( 'Table'[Value] );
    FILTER (
        'Table';
        'Table'[Condition Period] IN VALUES ( 'Slicer 2'[Condition Period] )
            && 'Table'[Condition Personnel] IN VALUES ( 'Slicer 2'[Condition Personnel] )
    )
)

 

Now just add the slicers and the measure to your chart.

 

Check PBIX file attach.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Anonymous
Not applicable

Hi sorry one more question - by default, the 2 calcuations should both equal to 10991 since no filter has been selected.

 

But if you look at the graph, the total for slicer 2 calcuation is incorrect.. can you please help ,cheers - i have exported the table for your reference

 
Condition Period Slicer 1 CalculationSlicer 2 Calculation
01/01/2021 00:00 175 
01/02/2021 00:00 376 
01/03/2021 00:00 235 
01/04/2021 00:00 274 
01/05/2021 00:00 471 
01/06/2021 00:00 154 
01/07/2021 00:00 159 
01/08/2021 00:00 229 
01/09/2021 00:00 285 
01/10/2021 00:00 441 
01/11/2021 00:00 265265
01/12/2021 00:00 404 
01/01/2022 00:00 387 
01/02/2022 00:00 316 
01/03/2022 00:00 413 
01/04/2022 00:00 139 
01/05/2022 00:00 440 
01/06/2022 00:00 306 
01/07/2022 00:00 249 
01/08/2022 00:00 416 
01/09/2022 00:00 424 
01/10/2022 00:00 140 
01/11/2022 00:00 413 
01/12/2022 00:00 230 
01/01/2023 00:00 429 
01/02/2023 00:00 138 
01/03/2023 00:00 485 
01/04/2023 00:00 266 
01/05/2023 00:00 330330
01/06/2023 00:00 426 
01/07/2023 00:00 341 
01/08/2023 00:00 260 
01/09/2023 00:00 127 
01/10/2023 00:00 405 
01/11/2023 00:00 443 

Hi @Anonymous ,

 

Based on my file I have reset the filters and everything is correct.

 

I have append a new file with 3 cards one for values on original table and the other two with the slicer calculated values as you can see 3 cards are the same and the lines on the line charts are equal also, so everything working properly.

 

Did you clear all the filter from your slicer 2? Are you sure the tables from slicer 2 are exactly equal to slicer 1 tables and to Values table?

 

From the table you present the slicer for personnell in slicer 2 as only 2 values selected. you need to reset it also

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Anonymous
Not applicable

Thank you so much ! all sorted ! have a nice evening

Anonymous
Not applicable

Thank you ! you are a star

Hi @Anonymous ,

 

No problem with that you can do it, if you are making that kind of setup with 4 tables for slicers I advise you to make the dates tables continuous so going from 1 January till 31 december. It will help you in the future if you want to make YTD, MTD or any other time inteliggence calculations.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Anonymous
Not applicable

thank you! its a really good suggestion.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.