JSON to JSON Liquid template transformation - azure-logic-apps

I am very new to this Azure Liquid templates. I'm parsing JSON to JSON using Dot Liquid.
I have "userDefinedFields" under "data" is an array of 4 fields i.e., Reason, Number, Bill and Key. In JSON, sometimes "userDefinedFields" may have 4 fields or 3 fields or 2 fields. I have to get all the 4 fields (Reason, Number, Bill and Key) from "userDefinedFields" and rest fields from "data" as an output of Liquid transformation:
id
newID
userDefinedFields :
if name=="Reason", get the value
if name=="Number", get the value
if name=="Bill", get the value
if name=="Key", get the value
I want Liquid template code to pick all the 4 fields together as one set (whether it has null value or proper value).
What can I try next?

Related

Google Data Studio convert metric to dimension not working

I have imported my GA4 data into Google Data Studio and am trying to see how many giftcards have been sold by their value.
The item revenue metric in GA4 is equal to the giftcard value (i.e. revenue = $200 therefore $200 giftcard was sold).
I want to breakdown sales by giftcard value like so:
Giftcard (revenue)
Count
$200
4
$250
3
$300
6
To do this, I need to set a copy of item revenue as a dimension rather than a metric.
In Google Data Studio, I can create a calculated field with the following formula that should convert the item revenue into text:
CAST(Item Revenue AS TEXT)
The problem I'm having is that while the formula sets the field type as text, it is still regarded by GDS as a metric and can't be used as a dimension.
Even when I try to add text, GDS still recognises the field as a number:
CONCAT(CAST(Item Revenue AS TEXT), " giftcard")
To use a metric as a dimension you can make a combination of data. When defining the graphic element (table, for example) and the respective data source, just create a data combination, but do not combine the data with any other source and just define the combination with the initial data itself. So you will have the same data structure only through a combined structure.
When making a combination of data, data studio recognizes all calculated fields (metrics) as dimensions. Thus, it is possible to make the conversion.

How to count the particular values in the field in Google Data Studio

I am trying to create a simple table in Google Data Studio, which fetches data from MySql table. For example,
"Peter
John
Mike
Peter
George
Peter"
The above are the set of values in a field,
Here I have to count the number of "Peter" in the field and display the count.
Is it possible to display the count of particular values from a single field? If so, what function should I apply to get the required output?
I would suggest using a REGEXP_MATCH function to create a new field. Try this:
Create new field called Peter Count and use this formula:
CASE
WHEN REGEXP_MATCH(FIELD_NAME, "Peter") THEN 1
ELSE 0
END
Make sure the new field has a field type of Number and aggregation of SUM
Create a scorecard in your report and select your new field as the metric.
That should add up the occurrences of Peter and ignore other names.

Sum of one field minus sum of another SSRS Expression

I have a SSRS report I'm working on. What I would like to do is get the value of one field from its own dataset and subtract the value of another field from a different dataset. I can do this; however, the values are grouped so rather than giving me an individual value it gives me: (sum of all completed) - (sum of all completed the previous year).
Here is my expression I am using for the column "Compared to last year"
=SUM(Fields!Completed.Value, "MTDSales") - SUM(Fields!Completed.Value, "MTDminus1")
"MTDSales" and "MTDMinus1" are 2 seperate datasets. MTDSales Dataset is the current months sales outcomes grouped by company MTDMinus1 dataset is last years figure for this current month as i am comparing the 2 months separately.
I had to do this in a report where I was pulling current data from one database and older data from a data warehouse and combining. You will need to do a few things:
1. Establish a match field
This can be as simple as a single column. If you need to match on multiple fields you will need to add a calculated field to each dataset that you can match on. Assuming you need to match on company and financial year and each dataset returns one year of data, this might look something like match_id (assuming numeric values - otherwise you might need to use | or something as a separator):
`="A" & Fields!fin_year.Value & "B" & Fields!cust_id.Value`
2. Retrieve the data to the source field.
In your tablix add a column as you have to hold the looked up value:
=Lookup(Fields!matchId.Value, Fields!matchId.Value, Fields!Completed.Value, "MTDminus1")
3. Use the data
Now you can aggregate the data or do whatever further calculations you wish as if the field was part of your original dataset.

Array formula having unique values for Data Validation dropdown without using helper column

I am trying to create an array defined name to enter into a data validation dropdown without using any helper columns in the sheet.
I have a table containing one of the column headers called 'List' which contains names of employees. The names may be duplicated, hence I want to extract only the unique names and put them into a data validation dropdown. I don't intent to use VBA and don't want to use any helper columns to drag the formula down to populate the unique names. On pressing F9, the formula should return unique values in an array like this:
{tom;fawad;george;jane;mario;flavia}
The table column looks like this:
List Column 2 Column 3 .....
tom
fawad
george
george
jane
mario
flavia
mario
george
fawad
Right now the formula is returning only one value when pressing F9 key.
=INDEX(list,IFERROR(SMALL(IF(FREQUENCY(MATCH(list,list,0),ROW(INDIRECT("1:"&COUNTA(list)))),ROW(INDIRECT("1:"&COUNTA(list))),""),ROW(INDIRECT("1:"&COUNTA(list)))),""))
I think it may require TRANSPOSE or SUBSTITUTE function to split the returned values across dropdown rows. Someone had demonstrated something like this, but I don't remember the link now.
Anyone know how to create a unique names array formula that I can simply enter directly into a Data Validation dropdown?

issue trying to use combine value to get a value from a datasource

I have a summary report with a multiples dataset used in differents lookup, I know the lookup compare single values only, I need to compare double value in a datasets and return the value, I'm trying to using a combined source in a first parameter of lookup but I'm not sure if it will be work
dataset1
name team value
----------------
john team1 3
john team2 4
mark team1 2
jane team2 1
I want to use lookup for this dataset using name and team together to build a unique key and get the correct value like a
lookup for "john+team1" and get the value 3
Any help or idea???
Would it not be easier to compare the 2 datasets within SQL rather than trying to do it in SSRS? Temp table1 would be name etc
Write one massive query to combine all of the data, that was it's easier/ quicker to use and it can be used in one table

Resources