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
adean137
Helper I
Helper I

Show values if certain conditions are met

Hello,

 

Hoping someone can help me figure this out. I've tried a few options but none of them are efficient and using too much memory. For simplicity, I've outlined some sample tables and data below:

 

Table 1 and Table 2 are linked by keyword. Table 2 and Table 3 are connected by retailer.

 

Table 1 
keywordvalue
google maps10
amazon prime20
ebay cheap deals30
buy clothes online40
where to buy online50
amazon vs google60

 

Table 2  
keywordflagretailer
google mapsretailerGoogle
amazon primeretailerAmazon
ebay cheap dealsretailereBay
buy clothes onlinenon-retailer 
where to buy onlinenon-retailer 
amazon vs googleretailerAmazon
amazon vs googleretailerGoogle

 

Table 3 
retailerdomain
Googlegoogle.com
Amazonamazon.com
eBayebay.com

 

 

I have a table visual with keyword and value as columns. I also have domain and flag filters on the page. When domain google.com is selected and flag retailer is selected, this is the desired outcome:

 

keywordvalue
google maps10
amazon vs google60

 

When non-retailer flag is selected, I would expect the non-retailer keywords to show. 

 

Therefore even though other keywords have the retailer flag, I only want the retailer flag to be applicable to the selected domain, in this case I have selected google.com domain on the page, which is linked to the Google retailer. If I were to select ebay.com domain and retailer flag, I would expect only the keyword ebay cheap deals to show up.

 

Please let me know if you have any ideas!

 

Thanks in advance.

1 ACCEPTED SOLUTION
v-janeyg-msft
Community Support
Community Support

Hey, @adean137

It's a pleasure to answer for you.

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

Like this:

Measure =
VAR a =
    MAX ( Metrics[retailer 2] )
VAR b =
    MAX ( Flag[retailer 1] )
RETURN
    IF ( a = b || b = BLANK (), 1, 0 )

4.png

Here is my sample .pbix file. I hope it helps.

If you do not solve your problem, please feel free to ask me.

Best regards

Janey Guo

If this post helps,then consider Accepting it as the solution to help other members find it faster.

View solution in original post

13 REPLIES 13
adean137
Helper I
Helper I

Hi @v-janeyg-msft

Thanks for your help with that. It worked very well. 🙂

If I wanted to show the metrics (in the Metrics table) for only branded keywords (where Measure = 1), how can I achieve this at a domain level? For example, for the domain google.com I want to see the sum of metric 1 for branded keywords (where Measure = 1).

I have tried the measure below but it didn't work.

was __table =

ADDCOLUMNS (SUMMARIZE (

'Metrics',

'Metrics' [keyword]),

"desired_metric", SUM ('Metrics' [metric 1]),

"check", [Measure])

RETURN

IF (HASONEVALUE ('Metrics' [keyword]), [Measure], SUMX (__ table, [metric 1]))

Hello @v-janeyg-msft ,

 

Hope you are well.

 

I'm just wondering if you have any suggestions for achieving this functionality?

 

Thank you 🙂

Hi, @adean137 

 

Try like this in card:

 

Measure =
VAR tab =
    FILTER (
        SUMMARIZECOLUMNS (
            Metrics[keyword],
            Metrics[retailer 2],
            Metrics[metric 1],
            Flag[retailer 1],
            "sum", SUM ( Volumes[value] )
        ),
        [retailer 1] = [retailer 2]
    )
RETURN
    IF (
        SUMX ( tab, [metric 1] ) = BLANK (),
        SUM ( Metrics[metric 1] ),
        SUMX ( tab, [metric 1] )
    )

 

By the way,There are two sets of data in the table that are exactly the same, which may affect the results.

9.png

Best Regards

Janey Guo

Hi @v-janeyg-msft ,

 

Many thanks again for the response. 

 

I have tried to create this measure and add it to my table visual but I'm getting an error (see screenshot). In the table visual I also want to have domain as a field. Should this work with the measure you suggested?

 

Thanks for pointing out the duplicate data - this has been fixed so this isn't causing the issue.

 

Do you have any ideas?

 

Capture.PNG

Hi, @adean137 

 

In the previous reply, you mentioned that you only want to display the value in the card, which I did.The meaure is for card.

If you want to show field in table ,you only need to drag field to table.

Like this:

12.png

Here is my sample .pbix file.Hope it helps.

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.

v-janeyg-msft
Community Support
Community Support

Hey, @adean137

It's a pleasure to answer for you.

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

Like this:

Measure =
VAR a =
    MAX ( Metrics[retailer 2] )
VAR b =
    MAX ( Flag[retailer 1] )
RETURN
    IF ( a = b || b = BLANK (), 1, 0 )

4.png

Here is my sample .pbix file. I hope it helps.

If you do not solve your problem, please feel free to ask me.

Best regards

Janey Guo

If this post helps,then consider Accepting it as the solution to help other members find it faster.

Hi @v-janeyg-msft

Thanks for your help with that. It worked very well. 🙂

If I wanted to include this in a measure for a metric card to filter the keywords to only sum metric 1 (in the Metric table) for those keywords where Measure = 1, how can I achieve this?

I have tried the measure below but it didn't work.

was __table =
ADDCOLUMNS(SUMMARIZE(
'Metrics',
'Metrics'[keyword]),
"desired_metric", SUM('Metrics'[metric 1]),
"check", [Measure])
RETURN
IF(HASONEVALUE('Metrics'[keyword]), [Measure], SUMX(__table, [metric 1]))
Ashish_Mathur
Super User
Super User

Hi,

Brind over domain from Table3 to Table2 using RELATED() or LOOKUPVALUE() function.  Bring over domain and retailer from Table2 to Table1 using RELATED() or LOOKUPVALUE() function.  Now that all you want is from Table1, build your visual from Table1.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
NamishB
Post Prodigy
Post Prodigy

Hi @adean137 - If I understood this correctly, you are referring to Edit interactions

Based on selection of one slicer you want to stop filtering other slicer values?

 

For Eg:

Ebay with Retailer shows up ebay Cheap deals only as below:

 

NamishB_0-1604355096544.png

 

Google with Retail option selected (As in your example)

 

NamishB_1-1604355150695.png

 

 

If this is the desired output, You can click on domain Slicer, Top banner Format button >Edit interaction and click Stop filter from Flag Slicer. You can do same way from flag slicer to Domain slicer as well.

 

Hope this helps, if not please elaborate your requirements.

 

Cheers,

-Namish B

 

 

 

@NamishB  please let me know if you got my last response. 🙂 

 

Here is my file https://we.tl/t-Ly9qK1wi4k 

And here is what I'm trying to achieve:

adean137_0-1604357282423.png

 

Hi @adean137 - Can you share what relationships you using between Metrics and Flag tables?

I can see M: M but is this on Keywork Or Retailer2/Retailer1?

 

I think the relationship is wrong and this is causing confusion.

 

Cheers,

-Namish B

Hi @NamishB 

 

Thanks so much for your response. I'm so sorry, but I gave incorrect information in my first note. Please see below updated requirements:

 

Flag table:

keywordflagretailer 1
google mapsretailerGoogle
amazon primeretailerAmazon
ebay cheap dealsretailereBay
buy clothes onlinenon-retailer 
where to buy onlinenon-retailer 
amazon vs googleretailerAmazon
amazon vs googleretailerGoogle

 

Metrics table:

keyworddomainmetric 1metric 2metric 3retailer 2
google mapsgoogle.com104070Google
amazon primegoogle.com104070Google
ebay cheap dealsgoogle.com104070Google
buy clothes onlinegoogle.com104070Google
where to buy onlinegoogle.com104070Google
amazon vs googlegoogle.com104070Google
amazon vs googlegoogle.com104070Google
google mapsamazon.com306090Amazon
amazon primeamazon.com4070100Amazon
ebay cheap dealsamazon.com5080120Amazon
ebay cheap dealsebay.com10010100eBay
buy clothes onlineebay.com1202032030eBay
where to buy onlineebay.com1304020eBay
amazon vs googleebay.com1405030eBay
amazon vs googleebay.com503010eBay

 

Volumes table:

keywordvalue

google maps10
amazon prime20
ebay cheap deals30
buy clothes online40
where to buy online50
amazon vs google60
 

Data model:

test.PNG

 

Current output:

test 3.PNG

 

Desired output:

test 4.PNG

test 2.PNG

 

Please let me know if this makes sense? 

 

Thanks agian! 🙂 

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.