format number in specific currency based on another column data - reporting-services

In SSRS
I have a table with column person, column country, and column salary. I want the column salary in a specific currency format based on column country. For example, if column country is United States, corresponding salary should be displayed in $.
Similarly, if the country column shows India, then the salary column should show a rupee, etc.
I am a starter and unable to do this. Please tell me a simple way of doing this

You could return a second dataset with a list of Countries and their Currency symbols such as
Country Currency
USA USD
India RUP
UK GBP
Then you can use LOOKUP to 'look up' the value in the second datasset from the first, so a dataset of
Country Sales
India 404
UK 44
USA 1255
You can then used the lookup as follows
=Lookup(Fields!Country.Value,
Fields!Country.Value,
Fields!Currency.Value,
"DataSetCurrency") <--- Blue <Expr> in the example below
Remember, you can include more than one Placeholder (expression) in a cell, so a design like this
Would render as this (DataSetCurrency included for information only)
Hopefully this will answer your question, though please ask for clarification if required.

Related

Check number of one column from other column in sql

I have 2 columns, say dialer_code and country_code. I need to check whether the dialer_code matches with the country_code or not.
Example: dialer_code = 1234567890, so it will check whether 1234567890 in country_code matches any country_code entry. If not then it will remove the last digit (turning the value into 123456789) and check again. This repeats until only the first 2 digit are left.
dialer_code country_code country_name
190095 91 India
190098 44 UK
4456 20 Egypt
445678 1900 US
In the above example, 190095 will be checked in country_code, but we don't have anything matching with it so now it will check for country_code 19009, but we don't have anything matching it either, until we get to 1900. Now it's matching with US. So US has some call rate defined per second so it will return that value.
Assuming the dilaer_code contains country_code, you could use SUBSTRING, like this:
SUBSTRING(dialer_code, CHARINDEX(country_code, dialer_code), 100)

How to write SSRS 2017 expression for calculating percentages when report contains Row Groups level hierarchy data

I'm trying to show monthly data for products. A month can have any number of products from A to Z depends on availability of products for that month.
For example, January 2020 has products A, B, and C.
Total is sum(amount) for these products.
I have taken Column Groups hierarchy as MonthYear and Product; Row Groups hierarchy as City, State, Region, and Country.
I'm able to show Total column at State, Region,and Country level by adding up at group level.
But I'm facing difficulty in showing Product% column figures especially at State, Region,and Country level.
For Product%, I'm trying to write something like sum(amount)/[sum(amount) for ALL Products].
Could you please help me in writing SSRS expression for achieving Product% figures at State, Region,and Country level.
Assuming you have a row group called 'groupCity' then this should work.
=SUM(Fieldsamount.Value) / SUM(Fields!amount.Value, "groupCity")
You will need to change the expression to match the rowgroup name for each additional instance that you need it (so probably state, region and country)

Transform part of an identification number into text VBA access

Can someone help me with a little problem. In summary I have a db where you input someones personal details and I have 4 fields I would like VBA to generate automatically. First field is an ID Number field then following that is DateOfBirth and Age fields. They are auto generated from just the ID field. However, to save me time, I want a part of the ID number field to generate whether a person is male or female.
To explain this let me set an example. The ID number is based on South African identification number. It's a 13 digit number e.g. 851205 5205 08 6. The first 6 numbers tells the date of birth (1985/12/05). That part of the number updates my DOB field and then also tells me the persons age with more VBA. Now i want the numbers "5205" to auto generate my gender field whether a person is male or female. Females are assigned numbers in the range 0000-4999 and males from 5000-9999. If you like more detail then please Google 'decoding your South African ID Number'.
So if i should type in that ID number above then it will define the person as a male. Can anyone help me with some VBA?
Thank you
found a solution and it works just the way i want it to:
If (Mid([txtIDnumber].Value, 7, 4) > 4999) Then
Me.cboGender = "MALE"
Else
Me.cboGender = "FEMALE"
End If

multiple currencies in a single table

How to make a MySQL table that could contain multiple type of currencies ($, Euros, ...) ? And if I want to make a final report is their a way to make a sum of those currencies other than adding multiple if statements to the sum ?
There may be several aspects involved. So here is some brainstorming:
You offer the same product in different currencies, e.g. a toy for 10 EUR or 11 USD. So you'd probably have an item table plus an item_price table, where the latter has product number, currency and price. (An alternative would be to have just one price, e.g. in USD and a currency table with conversion rates and you'd calculate the foreign price. But then you'd get "ugly" prices, e.g. 10.57, rather than typical prices like 10.50, 10.90 or 10.99. But well, you could have a price adjustment funtion for that, too. And you'd have to keep your conversion tables up-to-date or live with possible losses.)
A customer buys products and pays the bill. The bill is in one currency (store price and currency in the bill), but you also get your money in your currency, as PayPal or the bank convert it at a daily rate. Do you need to store this real amount, too? Then that would be another column in your bill.
I don't know how it is about taxes. Different currencies sounds like different countries. Maybe you'd have to deal with these in your database, too. I just don't know. The prices you show and store are usually gross prices (the price a customer actually pays) and the taxes (could be different VAT percentages with different products in one single bill) would have to be calculated.
As to getting sums: with all the information stored you'd get them with joins from the tables. No if-then-else in my opinion.
As per my opinion you can create a Country Table which contains
CountryID, CountryName, CurrencyCode, ExchangeRate. Now In that
country table you have to add all countries which you want to add but
you have to keep one thing in mind that you have to decide 1 currency
as base currency and put exchangeRate as 1 for that currency and
convert all other currencies exchangeRate based on the base currency
and insert into that table. i.e. Keep base currency as USD so insert
1 record with USD and exchangeRate must be 1 for that currency.
Suppose I am adding India as country than exchangeRate for that
country is based on USD as 66.40 Rs. insert all other countries
according to this entries.
Now when you want to add any transaction related to money in any
table then keep exchangeRate column with that amount column. ind
insert the exchangeRate and amount same as user's currency. i.e. If
my user is in India country, so it's currency is INR. Now that user
wants to add 1000 Rs. then you have to enter that 1000 Rs amount in
transaction table as it is without any conversion with exchange Rate
of 66.40 (fetch from country table). Same way If user currency is USD
and he wants to add a transaction of 100$ than store 100 as Amount
and exchangeRate as 1.
Now when you want to create any reports then just divide exchangeRate
with Amount, so you will get report in your base currency and after
conversion in base currency you can generate each report in any
currency as per your requirement.

Microsoft Access 2010 - Filtering by a caculated field in a query-based report

Ok, here's the condensed form. I have three main tables to draw data from:
StudentData - PK is the student's ID Number. Contains contact info, their current status ('00' for none, 'P' for Probation, 'S' for Suspension), and cumulative gpa data.
CourseData - PK is the CRN. Contains just the abbreviated subject and the course number (IE ECON 200)
StudentCourses - PK is an AutoNum. Many-to-Many relationship table between StudentData and CourseData. Also contains stats for the particular student's class (grade, credit hours, etc).
So some sample data would look like:
-
StudentData
ID: 12345678
Name: John Doe; ...[Other contact info]; 00; CumCreditHours: 100; CumCoursePoints: 190
-
CourseData
CRN: 0001; Abbrev: ECON; CourseNumber: 101
CRN: 0002; Abbrev: CSCI; CourseNumber 201
-
StudentCourses
AutoNum: 1
StudentID: 12345678; CRN: 0001; Grade: A-; Credits: 3
AutoNum: 2
StudentID 12345678; CRN: 0002; Grade: B; Credits: 3
-
At this point, this is how I have things set up:
First, a query runs that finds all of the courses a student takes and converts the letter grades into a point value. Another query based on the first sums the point totals and the credit hours. A third query takes those totals and calculates the GPA by dividing their point total by the credit hour total.
Separately, a query runs that calculates the student's cumulative GPA by taking their cumulative points and hours from the StudentData table (again dividing the points by the hours).
Then, another query takes both the semester GPA, cumulative GPA, current status, and cumulative credit hours and calculates the recommended action for the student. So for our example data it would look like:
_
SemesterGPA: 3.33; CumulativeGPA: 1.90; CurrentStatus: 00; CumulativeCreditHours: 100
_
I have the formula to determine their recommended action set up as a series of nested IIF statements that looks like:
IIf([CurrentStatus]="00" And [CumulativeGPA]<2 And [CumulativeCreditHours]>=12 And [CumulativeCreditHours]<=23,"PFY",IIf([CurrentStatus]="00" And [CumulativeGPA]>=1.7 And [CumulativeGPA]<=1.99 And [CumulativeCreditHours]>=24,"P",IIf([CurrentStatus]="00 " And [CumulativeGPA]<2 And [SemesterGPA]<2 And [CumulativeCreditHours]<12,"W",IIf([CurrentStatus]="00" And [CumulativeGPA]>=2 And [CumulativeGPA]<=2.5 And [SemesterGPA]<2 And [CumulativeCreditHours]>=12,"WUP",IIf([CurrentStatus]="00" And [CumulativeGPA]<1.7 And [CumulativeCreditHours]>=24,"SUSP",IIf([CurrentStatus]="P" And [CumulativeGPA]<2 And [SemesterGPA]>=2 And [CumulativeCreditHours]>=12,"CP",IIf([CurrentStatus]="P" And [CumulativeGPA]>=2 And [SemesterGPA]<2 And [CumulativeCreditHours]>=12,"SPCP",IIf([CurrentStatus]="P" And [CumulativeGPA]>=2 And [CumulativeCreditHours]>=12,"RP",IIf([CurrentStatus]="P" And [CumulativeGPA]<2 And [SemesterGPA]<2 And [CumulativeCreditHours]>=12,IIf(IsNull([PriorSuspension]),"S(FD)","D(SD)"),"None")))))))))
For our example, John Doe's recommended action would be 'P' since his current status is 00, he has over 24 cumulative credits, and his cumulative gpa is between 1.7 and 1.99.
Now for the problem: I would like to be able to make a report that can filter by the recommended action. I've detailed the issues I've had previously, but in short, the way I have the reports set up now (with the information being displayed in a sub-report inside a report that is based on the StudentData table to provide the aforementioned queries with the StudentID) doesn't allow me to do this because the field I want to filter by exists in the sub-report and not the main report (and you can't set the filter properties for a sub-report).
Any ideas?
Ok, I've got this to work now. I realized that as I was calculating the semester GPAs that I had grouped the results together by ID at some point during the process. This allowed me to remove the part of the initial query that grabbed the ID number from the form. Since the last query in the process linked everything together by student ID, the individual records held all of the information I needed and everything fell into place after that.
I half expected something simple like this to be the answer to my problem, but I'm still disappointed that it took me this long to figure it out...
Anyway, thanks to anyone who might have been thinking of possible solutions for this problem.