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.

Reply
AnthNC
Helper I
Helper I

Calculate thresholds and use it in a slicer

Hi everyone,

 

Here's the project :

I'm showing on a line graph the evolution of the production in volumes (tons) and values (millions of francs) of several products for 2 regions (NC and PS).

 

There are 2 measures by region :

- total values NC and total volumes NC

- total values PS and total volumes PS

 

Those 4 measures have been regrouped in a field parameter.

 

What I'm trying to do :

Instead of the "Years" slicer circled red in the screenshot, I would like to have volumes or values thresholds that will filter and show only the product categories and subcategories which are in the selected thresholds.

AnthNC_1-1714456671316.png

 

In this example, I've filtered out all product categories inferior to 8000 MF :

AnthNC_2-1714457024971.png

 

Thing is, I can't show filter panes in this report. So the end user will not be able to use it.

 

Would you know a way to use a slicer like the filter pane ? 

Here's the pbix file :

https://drive.google.com/file/d/1a9eT8GAJ_Dcal5w24Yo1nrf-X1uKSAId/view?usp=sharing 

 

Thanks in advance 🙂

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @AnthNC ,

 

You can create a numeric parameter that will allow to do a filter based on the selected value then you need to add a measure similar to this:

 

Filter = VAR selectedMeasure =
		SWITCH(
			SELECTEDVALUE('Paramètre Measures'[Paramètre Commande]),
			0, [Total ValueNC],
			1, [Total VolumeNC],
			2, [Total ValuePS],
			3, [Total VolumePS]
		)
		RETURN


			SWITCH(
				SELECTEDVALUE('Paramètre Categories'[Paramètre Commande]),
				0, COUNTROWS(FILTER(
					SUMMARIZE(
						'local production',
						'local production'[Product category],
						"ValueSelected",
 selectedMeasure
					),
					[ValueSelected] >= Parameter[Parameter Value]
				)),
				1, COUNTROWS(FILTER(
					SUMMARIZE(
						'local production',
						'local production'[Product subcategory],
						"ValueSelected", selectedMeasure
					),
					[ValueSelected] >= Parameter[Parameter Value]
				))
			)

Then add it in the visualization and select is not blank:

MFelix_0-1714469457125.png

See 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



View solution in original post

3 REPLIES 3
MFelix
Super User
Super User

Hi @AnthNC ,

 

You can create a numeric parameter that will allow to do a filter based on the selected value then you need to add a measure similar to this:

 

Filter = VAR selectedMeasure =
		SWITCH(
			SELECTEDVALUE('Paramètre Measures'[Paramètre Commande]),
			0, [Total ValueNC],
			1, [Total VolumeNC],
			2, [Total ValuePS],
			3, [Total VolumePS]
		)
		RETURN


			SWITCH(
				SELECTEDVALUE('Paramètre Categories'[Paramètre Commande]),
				0, COUNTROWS(FILTER(
					SUMMARIZE(
						'local production',
						'local production'[Product category],
						"ValueSelected",
 selectedMeasure
					),
					[ValueSelected] >= Parameter[Parameter Value]
				)),
				1, COUNTROWS(FILTER(
					SUMMARIZE(
						'local production',
						'local production'[Product subcategory],
						"ValueSelected", selectedMeasure
					),
					[ValueSelected] >= Parameter[Parameter Value]
				))
			)

Then add it in the visualization and select is not blank:

MFelix_0-1714469457125.png

See 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



Thanks @MFelix 

It works great.

 

Is there a way to do the same slicer but with a min and max value, just like the year slicer where you can input 2 values :

AnthNC_0-1714523333560.png

 

Hi @AnthNC,

 

Yes you need to change the slicer to a between instead of single select. 

 

But if you are doing this you probably would need to change the metric to be greater than or less than. 

 

And don't forget to accept the correct answer to help out others


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



Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.