# add custom column based on another query



## rjmdc (Dec 27, 2022)

hi
i have a table of names and purchases
i have another query drilled down to a parameter called sevicemonth - this is manually changed as necessary
how do i add a column with service month and the date i have as servicemonth merged in to the names purchases query
isit possible?


----------



## jdellasala (Dec 27, 2022)

rjmdc said:


> hi
> i have a table of names and purchases
> i have another query drilled down to a parameter called sevicemonth - this is manually changed as necessary
> how do i add a column with service month and the date i have as servicemonth merged in to the names purchases query
> isit possible?


You say query which _implies_ you're using Power Query, but it's not clear if you're looking for a PQ solution or a Formula. It's also unclear whether "servicemonth" is a number or text, and when you say "merged" are you just looking to create a text string or a date.
Best way to make things clear is to post an example using *XL2BB*.


----------



## rjmdc (Dec 27, 2022)

thats not possible too much HIPPA protected info
1 quer has all my purchases data
the next query is a date drilled down based on worksheet with variables i created named range called servicemonth
i want to now merge in this servicemonth as a full column filled in with the servicemonth so that i can evaluate was purchase before or afyter servicemonth


----------



## jdellasala (Dec 27, 2022)

rjmdc said:


> thats not possible too much HIPPA protected info
> 1 quer has all my purchases data
> the next query is a date drilled down based on worksheet with variables i created named range called servicemonth
> i want to now merge in this servicemonth as a full column filled in with the servicemonth so that i can evaluate was purchase before or afyter servicemonth


No one said it has to be actual data. Make something up - as long as the data type, number of columns, etc. are the same. All that's needed is a few sample rows of the pseudo data, and a sample of the expected output.


----------



## rjmdc (Dec 27, 2022)

Services sample.xlsxA1NameServices
hi
in the services listing i want to add a column called service month and fill in the entire column with the date saved as servicemonth
this will later allow me to merge in a query based on the servicemoth date


----------



## jdellasala (Dec 27, 2022)

rjmdc said:


> Services sample.xlsxA1NameServices
> hi
> in the services listing i want to add a column called service month and fill in the entire column with the date saved as servicemonth
> this will later allow me to merge in a query based on the servicemoth date


Select the entire range and then click *Mini Sheet*. I never use the Table Only option. Not sure what the difference is. All you gave us is cell A1. Use the *Preview* button at the top right of the post to view it as it will be seen.


----------



## rjmdc (Dec 27, 2022)

i dont understand what did i give you?


----------



## jdellasala (Dec 27, 2022)

rjmdc said:


> i dont understand what did i give you?


I said - Cell A1 which has a value of "Name" in a white font and green background. Do you not see it above?


----------



## rjmdc (Dec 27, 2022)

Services sample.xlsxABCD1NameServiceAgencyCheckNumber2meSHRSPInspireDPP Inspire3myselfSHCHQuirkDPP Quirk4ISHCHHandsDPP Hands5nobodySHCHTTIDPP TTI6anybodySHRSPInspireDPP InspireServices

this is the sheet
the other sheet and query is the date variable


----------



## jdellasala (Dec 27, 2022)

rjmdc said:


> Services sample.xlsxABCD1NameServiceAgencyCheckNumber2meSHRSPInspireDPP Inspire3myselfSHCHQuirkDPP Quirk4ISHCHHandsDPP Hands5nobodySHCHTTIDPP TTI6anybodySHRSPInspireDPP InspireServices
> 
> this is the sheet
> the other sheet and query is the date variable


What is "the sheet"? The source data or the result? Whichever it is, post *both *and make it clear which is which.


----------



## rjmdc (Dec 27, 2022)

hi
i have a table of names and purchases
i have another query drilled down to a parameter called sevicemonth - this is manually changed as necessary
how do i add a column with service month and the date i have as servicemonth merged in to the names purchases query
isit possible?


----------



## rjmdc (Dec 27, 2022)

Services sample.xlsxAB1Reporting Month7/1/20222Variables

this is the query that creates service month
can i populate services with this servicemonth based on need


----------



## rjmdc (Dec 27, 2022)

its ok i figured it out
i did a custom column and refered to the data as #"ReportingMonth"


----------



## jdellasala (Dec 27, 2022)

rjmdc said:


> Services sample.xlsxAB1Reporting Month7/1/20222Variables
> 
> this is the query that creates service month
> can i populate services with this servicemonth based on need


Where does the date come from? There is NOTHING in the Table in your Response #9 with anything even implying a date. How is the date in B1 determined from the data in #9? Is "Reporting Month" data or a label, and if it's a label why is it to the left instead of as a column header?


----------



## rjmdc (Dec 27, 2022)

i figured it out
thanks


----------

