cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Groups online and offline conversion

Hello, I have online and offline conversions.

 

Examples:

google ads campaign 1 - 10 leads

phone line 1 - 10 leads

 

I would sum these leads into one column, but with some filters. For example: sum "campaign 1" + "phone line 1" into "campaign 1"; sum "campaign 2" + "phone line 2" into "campaign 2".

 

Is this possible?

 

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User IV
Super User IV

Re: Groups online and offline conversion

Hi @tomasmartinek ,

assuming your model has Table1 and Table2, please paste this code into the advanced editor of a new query and follow the steps:

 

let
    Source = Table1,
    #"Split Column by Delimiter" = Table.SplitColumn(Source, "Campaign", Splitter.SplitTextByEachDelimiter({"_"}, QuoteStyle.Csv, true), {"Campaign.1", "Campaign.2"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Campaign.1", type text}, {"Campaign.2", Int64.Type}}),
    ConvertedTable1 = Table.RenameColumns(#"Changed Type",{{"Campaign.2", "no"}}),
    Custom1 = Table2,
    #"Split Column by Delimiter1" = Table.SplitColumn(Custom1, "Phone_line", Splitter.SplitTextByEachDelimiter({"_"}, QuoteStyle.Csv, true), {"Phone_line.1", "Phone_line.2"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter1",{{"Phone_line.1", type text}, {"Phone_line.2", Int64.Type}}),
    ConvertedTable2 = Table.RenameColumns(#"Changed Type1",{{"Phone_line.2", "no"}}),
    #"Merged Queries" = Table.NestedJoin(ConvertedTable1, {"no"}, ConvertedTable2, {"no"}, "Renamed Columns1", JoinKind.LeftOuter),
    #"Expanded Renamed Columns1" = Table.ExpandTableColumn(#"Merged Queries", "Renamed Columns1", {"Leads"}, {"Leads.Phone"}),
    #"Inserted Addition" = Table.AddColumn(#"Expanded Renamed Columns1", "Addition", each [Leads] + [Leads.Phone], Int64.Type),
    #"Removed Columns" = Table.RemoveColumns(#"Inserted Addition",{"Leads", "Leads.Phone"})
in
    #"Removed Columns"

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

View solution in original post

8 REPLIES 8
Highlighted
Super User IX
Super User IX

Re: Groups online and offline conversion

@tomasmartinek ,

@ImkeF , can you help on this



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Highlighted
Super User IV
Super User IV

Re: Groups online and offline conversion

Hi @tomasmartinek 

I'm afraid I don't understand the question.

Please check out these links: 

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

and ideally upload some sample data so we can quickly mock up a solution for it:

 https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Highlighted
Super User III
Super User III

Re: Groups online and offline conversion

@tomasmartinek ,

It would be better if you could explain it with sample input and expected output.

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!
You can follow me on LinkedIn

Please take a quick glance at newly created report:
My Report
Highlighted
Helper I
Helper I

Re: Groups online and offline conversion

Hello @ImkeF 

 

Below are tables and results which I expect. Lead may be generated from the website or by calling. I know from what campaign is "offline" lead. If a visitor calls me on the phone line 2 is from campaign 2. The issue with mapping is (maybe), that are a few phone lines paired with more than one campaign. Those I have to split (next step).

 

Hope it is cleaner.  

 

Table1

CampaignLeads
Campaign_110
Campaign_220

Table2

Phone_lineLeads
Phone_line_120
Phone_line_230

 

The result should be:

CampaignLeads
Campaign_130
Campaign_250

 

 

Highlighted
Super User IV
Super User IV

Re: Groups online and offline conversion

Hi @tomasmartinek ,

assuming your model has Table1 and Table2, please paste this code into the advanced editor of a new query and follow the steps:

 

let
    Source = Table1,
    #"Split Column by Delimiter" = Table.SplitColumn(Source, "Campaign", Splitter.SplitTextByEachDelimiter({"_"}, QuoteStyle.Csv, true), {"Campaign.1", "Campaign.2"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Campaign.1", type text}, {"Campaign.2", Int64.Type}}),
    ConvertedTable1 = Table.RenameColumns(#"Changed Type",{{"Campaign.2", "no"}}),
    Custom1 = Table2,
    #"Split Column by Delimiter1" = Table.SplitColumn(Custom1, "Phone_line", Splitter.SplitTextByEachDelimiter({"_"}, QuoteStyle.Csv, true), {"Phone_line.1", "Phone_line.2"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter1",{{"Phone_line.1", type text}, {"Phone_line.2", Int64.Type}}),
    ConvertedTable2 = Table.RenameColumns(#"Changed Type1",{{"Phone_line.2", "no"}}),
    #"Merged Queries" = Table.NestedJoin(ConvertedTable1, {"no"}, ConvertedTable2, {"no"}, "Renamed Columns1", JoinKind.LeftOuter),
    #"Expanded Renamed Columns1" = Table.ExpandTableColumn(#"Merged Queries", "Renamed Columns1", {"Leads"}, {"Leads.Phone"}),
    #"Inserted Addition" = Table.AddColumn(#"Expanded Renamed Columns1", "Addition", each [Leads] + [Leads.Phone], Int64.Type),
    #"Removed Columns" = Table.RemoveColumns(#"Inserted Addition",{"Leads", "Leads.Phone"})
in
    #"Removed Columns"

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

View solution in original post

Highlighted
Super User IV
Super User IV

lRe: Groups online and offline conversion

... enclosing the file as well.

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Highlighted
Community Support
Community Support

Re: Groups online and offline conversion

Hi @tomasmartinek 

It seems there is possible solution here.

Besides, you could create bridge table and link two tables with this table, then sum values from two tables.

If you have any other problem, feel free to let us know.

 

Best Regards

Maggie

 

Highlighted
Helper I
Helper I

Re: lRe: Groups online and offline conversion

@Ink thank you very much

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Come join us today! Find your favorite faces from the community presenting at the Power Platform Community Conference!

Upcoming Events

Experience what’s next for Power BI

See the latest Power BI innovations, updates, and demos from the Microsoft Business Applications Launch Event.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors
Top Kudoed Authors