SSAS Dimension - genuinely repeated data in 1 column, how to deal? - duplicates

I have a dimension (DimContact) which looks like this:
ContactAlternateKey ContactDOB ContactFullName ContactPostalAddress
12345 17.4.2000 Timo Ohio 17 Blah Street
12346 17.4.2000 Miki Massa 25 Other Street
12347 19.1.1999 Sven Tokio 17 Blah Street
I have another Dim which is used for Addresses based on ParcelID (that's the ID for that actual piece of land) which works as planned. This Dim is populated from free text fields inside the source system, and not as structured as our Parcel data, also, the contactpostaladdress isn't necessarily in our country, so is just there for supporting information, rather than to serve a legitimate purpose.
When I process the Dim WITHOUT the ContactPostalAddress field as an attribute, everything works to plan, however as soon as I use that field too SSAS complains about a duplicate attribute key (which is one of the addresses that has been repeated - but actually the ContactFullName is different (2 people living at the same address), so is genuinely a different record.
Can anyone suggest how to get around this please? I am confused, as surely there are duplicate ContactDOB's in there too which SSAS is happy to work around.
I am using VS2015 on SQL Server 2016 Standard Edition.
Thank you

Moments later I had a lightbulb moment - and have implemented a change in the KeyColumns area of the Properties for the ContactPostalAddress. I have ordered the "Key Columns" with ContactAlternateKey as first on the list and then ContactPostalAddress as second on the list. This forces SSAS to do a distinct(both columns) when building the table, rather than just a distinct(ContactPostalAddress). This works a treat and hopefully will help another user in the future.

Related

How to Split the value and find the longest text string in google sheet

I have a column in google sheet in which each cell contains this type of text
manager, finance manager
accountant
accountant, chief accountant
manager, auditor, other, finance manager
accountant
I want to find the longest text like below and show that text into new cell
finance manager
accountant
chief accountant
finance manager
accountant
I used split function to split the text and find function but finding character or number of character is working but i am unable to understand how i will get whole longest word
Kindly help me.
An alternative would be to use
=FILTER(TRIM(SPLIT(A1, ",")), LEN(SPLIT(A1, ",")) = MAX(LEN(SPLIT(A1, ","))))
and fill down as far as needed.
Suppose your comma-separated lists reside in A2:A. Place the following in, say, B2 of an otherwise empty range B2:B ...
=ArrayFormula(IF(A2:A="",,TRIM(REGEXEXTRACT(A2:A,"[^,]{"&REGEXEXTRACT(TRIM(TRANSPOSE(QUERY(TRANSPOSE(IF(REGEXMATCH(A2:A,"[^,]{"&SEQUENCE(1,30,30,-1)&"}")=FALSE,,SEQUENCE(1,30,30,-1))),,30))),"\S+")*1&"}"))))
This is a complex formula, one that would be difficult to explain. So I will leave it to you (and others who may be interested) to dissect, analyze and understand the inner workings. However, if there is a specific question I can answer should you (or others) get stuck, feel free to ask.
In short, the formula checks to see if there are any REGEX matches for non-comma groupings of 30 characters in length, then 29, 28 and so on to 1. If so, that number is returned in a space-separated list. The first number (which will be the highest) is returned and used to extract a non-comma REGEX expression of that exact length (which then has any leading or trailing spaces removed from it).
if your text is stored in column A, you can use this formula:
=hlookup(max(arrayformula(len(trim(split(A1,","))))), {arrayformula(len(trim(split(A1,","))));arrayformula(trim(split(A1,",")))},2,False)
Second option is to write a custom function.

Access VBA: Set conditional format on duplicate text values

my first question here but I can't seem to find an answer anywhere.
I have created a report on which colleagues can see appointments booked by users.
But my colleagues would like to have a clear view of users with the same lastname so no appointments get mixed.
Example:
Joe Smith is booked at 15 o'clock.
Jane Smith is booked at 10 o'clock.
I would like to have the lastname Smith underlined/bold so the name "pops" while checking the list.
I've found some info regarding DCount but can't seem to be able to put it to use. I thought perhaps a Match-function might also work, but I can't specify cells of the Access report.
So I hope you guys can help me further.
Thanks anyway!
EDIT:
Here is a small screenshot, the name should be highlighted when it appears more than once in the report.
AccessReport
Here is the DCount you need.
Nz(DCount("*","[table]","[LastNameField] = '" & [LastNameField] & "'"),0)>1
I made a test database real quick to verify this worked. It goes in the conditional formatting expression. Just replace the table and field names to what you are using.

Converting measurements in a form to update a table

I am using Access 2010 to create a database of fish caught by local fishermen. I have a table with all the information about each fish caught (location, day, length, etc) and a form to add new records to that table. I am trying to automate as much of the data entry as possible because we have many interns that will be entering data throughout the summer. The more I can have the program do, the more I can limit mistakes in data entry.
I would like to store the length data in metric (mm), however most of the fishermen report the lengths of the fish they catch in inches. I don't care to have length twice in my database, one metric and one imperial.
Is there a way I can have a box on the form that someone can enter the length in inches and this value is converted to metric and used to fill in the length field on the table? The trick is that sometimes the fish length is reported in metric, so I need to be able to directly input metric into the form too.
I'm guessing this is either not possible or already somewhere & I am not using the right key words in my searches. I appreciate anyone who can point me in the right direction.
Thanks!
Here's one way to do it. It's similar to Scotch's, but with a few enhancements.
Have 2 textboxes. 1 each for millimeter & inch sizes.
The Milimeters textbox is bound to the table through the Control Source, so what is entered in there is what is saved in the database.
The Inches textbox is unbound. But what is entered into that textbox is converted and the new value is put into the Millimeter textbox. The code would look like this:
Private Sub txtSizeIn_AfterUpdate()
Me.txtSizeMM = Me.txtSizeIn * 25.4
End Sub
This way, the fisherman will have a choice on what measurement to use.
In the After Update for your control in which the measurement is entered, say the control is called Length.
You can change it in vba with this code.
Me.length = me.length * 25.4
This is one of many ways to do this

Combining fields and replacing text in Crystal Reports

I am a new Crystal Reports user and any help would be greatly appreciated. I am looking for a formula that allows me to combine two fields and also make a text replacement (mapping project).
For example, I am looking to combine an address and city into one field so I use the formula:
{Location.Address}+","+" "+{Location.City}.
This is usually sufficient except for a common street in town which is abbreviated in the records system. I need for the entries which read "24 SGE, Albany" to read "24 Stargate East, Albany" so the address can be interpreted by the mapping software.
I tried something like
{Location.Address}+","+" "+{Location.City}
and
Replace({Location.Address}," SGE"," Stargate East")
I got the error, a boolean is require here. So I am probably still far off. Any suggestions?
Replace({Location.Address},"SGE","Stargate East") + ", " + {Location.City}

Reporting services: Join all field on a dataset

In a report, I've a dataset with a filter(based on a MultiValue parameter).
This dataset contains two field: Id and Name.
I need to display somewhere the concatenation of all names:
Name1 / Name2 / Name3
The problem is that the join method works only on array, and then I cannot specify a dataset as value.
I looked in custom code too, but I didn't found anything working.
How should I do this ?
I may be a bit late for this but for anyone that's interested in this, there is a rather easy way of doing this in SSRS:
=Join(LookupSet(1,1,Fields!Name.Value, "DatasetName")," / ")
SSRS-2008 R2 and higher...
1. Using LookupSet
If you're beyond the 2008 version OP has, there exists a good solution:
=Join(LookupSet(1, 1, Fields!Name.Value, "DatasetName"), " / ")
Credit for this answer using the LookupSet solution goes entirely to #urbanhusky's answer.
SSRS-2008 and lower...
I'm keeping this answer though because it aggregates #urbanhusky's solution with the solutions available to poor souls stuck with OP's version of SSRS and below.
In SSRS 2008 there's only three "options" as far as I can see, each with its own downside. The first one's probably the least hackish.
2. Extra parameter
Create an internal parameter (e.g. "NameParameter", see this SO answer or MSDN) with Allow Multiple Values. Set the default value of the parameter to the Name field from your dataset. Then use the function =Join(Parameters!NameParameter.Value, " / ") to show the joined names in a textbox.
This may be your best bet, but if there are a lot of values the parameter may not work very well.
3. Use a List
Create a List and drag/drop the Name field to it. If necessary, group on the Name as well.
The disadvantage here is that (AFAIK) the list can't be made to show horizontally.
4. Use a Matrix
Oh boy, this one's real ugly. Nonetheless, here goes: create a matrix, drag the Name field to the column header, and hide the first column as well as the second row (for displaying the data).
The main disadvantage is that it's a hack (and quite some overkill), plus you'll have to trim the last seperator character manually with an expression.