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
Johnn
Frequent Visitor

visual showing only merchants with both online and in-store transactions

Hi,

 

I have a fact table on transaction history linked to a merchant table. I have a column in the transaction table that signifies if the transactions were done in-store or online. I'm having a little difficulty trying to figure out how to create a visual that only shows merchants which have seen both online and in-store transactions. Thanks for any help!

1 ACCEPTED SOLUTION

Hi @Johnn,

 

You could consider an other solution. Please create below measures. Add measure [instore & online] into visual level filter, set its value to 2.

Max date =
CALCULATE (
    MAX ( 'Transaction'[Date] ),
    ALLEXCEPT ( 'Transaction', 'Transaction'[MerchantID] )
)

instore & online =
CALCULATE (
    DISTINCTCOUNT ( 'Transaction'[online/instore] ),
    FILTER ( 'Transaction', 'Transaction'[Date] = [Max date] )
)

1.PNG

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
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

3 REPLIES 3
v-yulgu-msft
Employee
Employee

Hi @Johnn,

 

From current information, it's hard to imagine how is your table structure like and what is your desired result. Please provide sample data, and tell us how to link the transaction table and merchant table. What is the common column between these two tables? And what do you mean 'only shows merchants which have seen both online and in-store transactions'?

 

Regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi,

 

The tables are structured as below. There is a one to many relationship between the Merchant Table and Transaction Table on Merchant ID. My desired result is that I want to create a visual that only shows Merchant A or the merchants that saw both online and instore transactions.

 

Capture.PNG

 

One way I tried to do it is to create two new columns in my merchant table:

 

Online Transactions = Countrows(CALCULATETABLE(relatedtable('Transaction Table'), 'Transaction Table'([online/instore]="online"))

Instore Transactions = Countrows(CALCULATETABLE(relatedtable('Transaction Table'), 'Transaction Table'[online/instore]="instore"))

 

And then in my visuals add a visual level filter where [Online Transactions] is not blank and [Instore Transactions] is not blank. But not sure if this is the most efficient way to do it and also it could be nice to have it be time dependent so if for example a merchant first started with both online and instore transactions and then just switched to only instore transactions I would be able to filter them out if my visual was only over that period of time where they only had instore transactions.

Hi @Johnn,

 

You could consider an other solution. Please create below measures. Add measure [instore & online] into visual level filter, set its value to 2.

Max date =
CALCULATE (
    MAX ( 'Transaction'[Date] ),
    ALLEXCEPT ( 'Transaction', 'Transaction'[MerchantID] )
)

instore & online =
CALCULATE (
    DISTINCTCOUNT ( 'Transaction'[online/instore] ),
    FILTER ( 'Transaction', 'Transaction'[Date] = [Max date] )
)

1.PNG

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
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.