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
mvgust
Helper III
Helper III

Add a flag column to show/not show records

Based on the below example, I need to create a flag column (show flag).  I don't know if it makes a difference but Total Hours and Union Hours are measures. Union Time Flag is a conditional column I added to a query in power editor. Work code is something I need to provide in the table visual but based on the union time flag I don't think that needs to be part if the conditional logic? 

 

EmployeeWork CodeUnion Time FlagTotal HoursUnion HoursShow Flag
Alley, TomOVEOther10 don’t show
Alley, TomPTBOther9 don’t show
Alley, TomRWOther151 don’t show
Barger, JohnRWOther160 don’t show
Carter, JustinODOther5 show
Carter, JustinOJOther12 show
Carter, JustinRWOther4 show
Carter, JustinUBPUnion Time156156show
Delgado, JessieOVIOther44 don’t show
Delgado, JessieRWOther144 don’t show
Donovan, GregODOther13.8 show
Donovan, GregODIOther35.4 show
Donovan, GregOJOther14 show
Donovan, GregOJIOther12.5 show
Donovan, GregRWOther59.5 show
Donovan, GregRWOOther42.5 show
Donovan, GregVOther8 show
Donovan, GregUBPUnion Time4242show
Donovan, GregUXUnion Time88show
Harbert, KevinOJOther59.7 don’t show
Harbert, KevinRW2Other144 don’t show
Harbert, KevinRW8Other96 don't show
1 ACCEPTED SOLUTION
v-janeyg-msft
Community Support
Community Support

Hi, @mvgust 

 

It’s my pleasure to answer for you.

According to your description,I think you can create a measure, then use it in filter pane.

Like this:

Measure 2 =
VAR a =
    CALCULATETABLE (
        DISTINCT ( 'Table'[Employee] ),
        FILTER ( ALL ( 'Table' ), [Union Hours] <> BLANK () )
    )
RETURN
    IF ( SELECTEDVALUE ( 'Table'[Employee] ) IN a, "show", "don't show" )

7.png

If it doesn’t solve your problem, please feel free to ask me.

 

Best Regards

Janey Guo

 

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

5 REPLIES 5
v-janeyg-msft
Community Support
Community Support

Hi, @mvgust 

 

It’s my pleasure to answer for you.

According to your description,I think you can create a measure, then use it in filter pane.

Like this:

Measure 2 =
VAR a =
    CALCULATETABLE (
        DISTINCT ( 'Table'[Employee] ),
        FILTER ( ALL ( 'Table' ), [Union Hours] <> BLANK () )
    )
RETURN
    IF ( SELECTEDVALUE ( 'Table'[Employee] ) IN a, "show", "don't show" )

7.png

If it doesn’t solve your problem, please feel free to ask me.

 

Best Regards

Janey Guo

 

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

westwrightj
Resolver III
Resolver III

Hey @mvgust 

 

   I think I understand what you are trying to do. Could you give more details on when the "don't show" or "show" would be selected?

 

   What is the business rule that defines if you want to show or not show a certain row?

 

 

The basic logic is if an employee has union hours, I need to show ALL their hours in the table visual. If an employee doesn't have union hours, I need them excluded from the table visual.

Ah! Yes I think I fully understand what you are trying to do now. Thanks for clearing that up.

 

So, you can make a calculated column like this

 

Show Flag = 

var TheMeasurement = CALCULATE([Union Hours Measure], ALLEXCEPT('Table', 'Table'[Employee]))

return

IF(TheMeasurement > 0, "Show", "Don't Show")

 

 

This will reproduce the flag you were looking for in your example

 

westwrightj_0-1605209809499.png

 

 

From here just include that flag in the filter pane and you should be good to go

 

westwrightj_1-1605209853914.png

 

 

I'll be using the filter on a table visual.  I will only be showing the records that are marked "show".

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.