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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
rpinxt
Impactful Individual
Impactful Individual

Way to get outcome of a measure in a slicer

So I know you cannot have the outcome of a measure into a slicer, but surely there is some kind of workaround??

 

If I have this :

rpinxt_0-1711465107722.png\

 

Late Indicator is just a measure stating that if HourNr > 20 then "Late" else "On Time"

Now I would like to give the user the opportunity to only show all "Late" by selecting that option in a slicer.

(don't want them to use the filer pane themselves)

 

Would think that happens 1000 times a day for people making reports.

So there must be something you can do about this?

 

10 REPLIES 10
Ashish_Mathur
Super User
Super User

Hi,

Share the download link of the PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-zhengdxu-msft
Community Support
Community Support

Hi @rpinxt 

 

Please try this:

First of all, I create a set of sample:

vzhengdxumsft_1-1711504077822.png

Then add a new table:

Table 2 = {"On time","Late"}

Next, add a measure2:

Measure 2 = 
	VAR _newData = SELECTEDVALUE('Table 2'[Value])
	RETURN
		IF(
			[Measure] = MAX('Table 2'[Value]),
			MAX('Table 2'[Value])
		)

The result is as follow:

vzhengdxumsft_2-1711504525975.png

vzhengdxumsft_3-1711504539567.pngvzhengdxumsft_4-1711504547019.png

 

Best Regards

Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks @v-zhengdxu-msft your solution seems to work well.

But there is a severe difference with my situation I think.

Your field Status, which indicates if a line is Late or On Time, is a table field.

 

But my field Late Indicator is not a table field. It is a Measure.

So in your dax for Measure :

Measure =
VAR _currentID = MAX('Table'[ID])
VAR _currentStatus = CALCULATE(SELECTEDVALUE('Table'[Status]),FILTER(ALLSELECTED('Table'),'Table'[ID]=_currentID))
RETURN IF(_currentStatus = "OT","On time",IF(_currentStatus = "LT","Late"))
 
You refere to a 'Table'[Status] field which is an acual field. But in my setup that is a measure.
 
This because my field Late Indicator is setup like :
Late Indicator = IF(
    NOT ISBLANK([Hours]),
    IF(NOT ISBLANK([Qty]),
IF([Hours] > TIME(20,00,00), "Late", "On Time")
)
)

Hi @rpinxt 


I think may be you can give this solution a chance that the solution is to use the values in the new table to match what the measure returns.

Please have a try.

 

Best Regards

Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Well I did try @v-zhengdxu-msft .

But what I am saying is that in this line :
CALCULATE(SELECTEDVALUE('Table'[Status]),FILTER(ALLSELECTED('Table'),'Table'[ID]=_currentID))

 

The bold part I cannot put in my field 'Late Indicator' because that is a measure.

Slectedvalue command will not accept it.

Hi @rpinxt 

 

Maybe I'm explaining it incorrectly, you don't need to copy the measure.

The measure is created as a reference.

What you need to do is to create a new table and add a measure 2, you can use your measure[Late Indicator] to replace the [measure]. 

vzhengdxumsft_0-1711529594001.png

Or could you please provide more raw data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution.

 

Best Regards

Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Ok I think I get it.

So I now did that:

rpinxt_0-1711533608722.png

 

So the blanks I can handle, just do indicator when Hours is not blank.

But look at the reds. That is not right. The Late Indicator gives On Time (correct because < 20) but the Indicator says late.

 

I put the test file here so you can have a look:

https://drive.google.com/file/d/1kqEl5FpSeuGMDqEMP24J0XDK8hIx8AeO/view?usp=sharing

Hi @rpinxt 

 

Unfortunately that this link cannot be open.

vzhengdxumsft_0-1711613421777.png

Maybe you can share your data(excluding sensitive data), or create some sample data.

It would be helpful to find out the solution. You can refer the following links to share the required info:

How to provide sample data in the Power BI Forum

 

Best Regards

Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

That is strange @v-zhengdxu-msft , I checked and the link is public. Maybe google drive had problems.

 

I will paste the snippet of data for the screenshot I share in a table :

Material Document NumberMaterialBatchMat/BatchPosting DateTimeSlocMvTQty
344216174660023819840214G160023819840214G13/5/202411:30:53INTR311-1400
504575598460023819840214G160023819840214G13/4/202414:31:14INTR1011400
344216968560023819840215G160023819840215G13/5/202412:08:21INTR311-1370
504575598460023819840215G160023819840215G13/4/202414:31:14INTR1011370
344298894360023819840217G160023819840217G13/8/202412:38:10INTR311-540
344298894460023819840217G160023819840217G13/8/202412:38:45INTR311-540
344298894760023819840217G160023819840217G13/8/202412:39:31INTR311-325
504581387760023819840217G160023819840217G13/7/202414:11:14INTR1011405
344298202560023819840219G160023819840219G13/8/202411:59:40INTR311-540
344298208460023819840219G160023819840219G13/8/202412:00:50INTR311-540
344298279660023819840219G160023819840219G13/8/202412:01:45INTR311-295
504581387760023819840219G160023819840219G13/7/202414:11:14INTR1011375
344420230460023819840220G160023819840220G13/14/202410:07:40INTR311-360
344420977360023819840220G160023819840220G13/14/202410:40:29INTR311-530
344421290760023819840220G160023819840220G13/14/202410:52:15INTR311-495
504589829760023819840220G160023819840220G13/13/202418:26:13INTR1011385

Hi @rpinxt 

 

I don't even understand why this workaround went wrong on your side, I will attach the pbix file in this post.

Some measures may be lacked, here I add two measure([Hours],[Qty1]) to analog them, but that's no matter, they won't affect the outcomes.

A new table added just like the reply I posted first:

Table 2 = {"On time","Late"}

Then add a new measure:

Measure 2 = 
	VAR _newData = SELECTEDVALUE('Table 2'[Value])
	RETURN
		IF(
			[Late Indicator] = _newData,
			_newData
		)

The result is as follow:

vzhengdxumsft_0-1711940788826.pngvzhengdxumsft_1-1711940795966.png

Actually that I think the measure isn't a good idea to use the slicer.

 

Best Regards

Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.