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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anima
Frequent Visitor

Assistance with Filtering a Line graph visual based on values assigned from a measure.

Hello Everyone, 

I'm relatively new to Power BI and I was hoping for some assistance. 
I'm attempting to write a measure that filters a line graph to only show items where the Quantity does not change over the selected timeframe. 

This is my current measure

Anima_0-1710352158863.png


When I apply this measure to a card visual, it correctly displays a value of "1" if the item quantity has not changed during the selected timeframe and a Value of "0" if the value has changed.

Anima_1-1710352266348.png

In the above example, I have "Zebra Printer Shoulder Strap" selected and the quantity remains at 217 over the course of the selected timeline. 
When I attempt to add that same measure to the line graph as a visual level filter and set it to "Show items when the value = 1", it does not actually filter the visual to only show items where the quanitity has not changed as shown below.  

Anima_2-1710352360277.png


These are the relationships that I have applied.

Relationships.png

Example PBIX file Example Data.zip

Any help would be appreciated

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anima ,

Please change the DAX into this:

Zones Stagnate Items = 
VAR SelectedStartDate = MINX(FILTER(ALLSELECTED('Zones Historical Inventory'),[PartNumber] in VALUES('Zones Historical Inventory'[PartNumber])),[Date])
VAR SelectedEndDate = MAXX(FILTER(ALLSELECTED('Zones Historical Inventory'),[PartNumber] in VALUES('Zones Historical Inventory'[PartNumber])),[Date])

VAR StartDateQuantity = 
CALCULATE(
    SUM('Zones Historical Inventory'[OnHand]),
    'Zones Historical Inventory'[Date] = SelectedStartDate
)
VAR EndDateQuantity = 
CALCULATE(
    SUM('Zones Historical Inventory'[OnHand]),
    'Zones Historical Inventory'[Date] = SelectedEndDate
)
VAR Difference = EndDateQuantity - StartDateQuantity

RETURN
IF(Difference = 0, 1, 0)

And the final output is as below:

vjunyantmsft_0-1710407689234.png

vjunyantmsft_1-1710407716215.png


Best Regards,
Dino Tao
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
Anonymous
Not applicable

Hi @Anima ,

Please change the DAX into this:

Zones Stagnate Items = 
VAR SelectedStartDate = MINX(FILTER(ALLSELECTED('Zones Historical Inventory'),[PartNumber] in VALUES('Zones Historical Inventory'[PartNumber])),[Date])
VAR SelectedEndDate = MAXX(FILTER(ALLSELECTED('Zones Historical Inventory'),[PartNumber] in VALUES('Zones Historical Inventory'[PartNumber])),[Date])

VAR StartDateQuantity = 
CALCULATE(
    SUM('Zones Historical Inventory'[OnHand]),
    'Zones Historical Inventory'[Date] = SelectedStartDate
)
VAR EndDateQuantity = 
CALCULATE(
    SUM('Zones Historical Inventory'[OnHand]),
    'Zones Historical Inventory'[Date] = SelectedEndDate
)
VAR Difference = EndDateQuantity - StartDateQuantity

RETURN
IF(Difference = 0, 1, 0)

And the final output is as below:

vjunyantmsft_0-1710407689234.png

vjunyantmsft_1-1710407716215.png


Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you for the assistance. 

I ended up figuring out a solution that involves creating a calculated column. 
This is the DAX that I have set for my calculated column. It checks the Part Number + Inventory Owner and then compares the On Hand quantity values against any other instance of that same Part Number + Inventory Owner and if the On Hand quantity has changed, it returns 1 else 0. 


Anima_0-1710426213843.png

I applied this calculated column as a visual level filter to my line graph and then set the filter value to " Is = 0" and that filtered my line graph to show only items where the quantity doesn't change. 
While this specific route doesn't account for date changes, It does allow me to present this data in other types of visuals, so I'm going to keep messing around with the solution you provided and this one. 

Thanks again for your assistance.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.