how can i generate kendo chart similar to like this - kendo-asp.net-mvc

I am trying to generate multi dimensional chart in kendo..
I have datatable like this
I am trying to generate similar to like this..
Instead of Alphabets/Directions it should replace to "Year column 2010...2014..."
Instead of "ABC" It should come "Nationality --- Bahraini, Non Bahraini"
Instead of "DEF" It should come "Sector --- Public,Private, Other etc"
Instead of "New Column" It should come "Gender --- Male,Female"

I don't know if you figured how to make this chart but this jsbin have a similar example.
You only have to use categoryAxis attribute.

Related

How to replace a column value using PowerQuery editor

I'm relatively new to Power Query. I'm looking for the best way to replace a column's value as below.
The column has date values in a mixed format such as below.
09/16/2022
09/20/2022
09/26/2022
09/30/2022
10-01-2022
10-03-2022
10-05-2022
I'm looking to standardize and make the format generic as below.
09-16-2022
09-20-2022
09-26-2022
09-30-2022
10-01-2022
10-03-2022
10-05-2022
It seems one of the ways to implement this is to use Advanced Editor and build M queries to implement the replacement, functions like Table.TransformColumns and Text.Replace.
'can't figure out the exact code to be used with this or if there is a better way.
Looking for suggestions. Thanks.
If you're a beginner, let the UI write this code for you. Highlight the column by clicking the column header, go to Transform on the ribbon and click Replace Values. Replace "-" with "/" and click OK.
Finally right click the column header again, click Change Type and then select Date.
In M code you could use:
Table.TransformColumns(#"Previous Step",{{"Column Name", each Text.Replace(_,"/","-")}})
As an example:
let
//create sample table
Source = Table.FromColumns(
{{"09/16/2022",
"09/20/2022",
"09/26/2022",
"09/30/2022",
"10-01-2022",
"10-03-2022",
"10-05-2022"}},
type table[dates=text]),
//replace "/" with "-"
Normalize = Table.TransformColumns(Source,{{"dates", each Text.Replace(_,"/","-"), type text}})
in
Normalize
Source
Results
Notes:
Original data is dates as text strings
Final data is also dates as text strings
To convert the strings to dates, you could use, instead, something like: Table.TransformColumns(Source,{{"dates", each Date.From(_, "en-US"), type date}}) but the separator would be in accord with your Windows Regional date settings.

How to conditionally format text in PowerBi

Is there a way to conditionally format my table so I can add a bar like below? (it was created in excel)
Image I want to create:
I am currently stuck with the following - I highlighted the dates but need to know how I can highlight the holidays in my table with that grey color. (the picture below uses Thanksgiving as the example). My goal is to highlight each individual holiday in the table in grey.
Image I need to conditionally format
Here is what I tried with the formula provided below:
Attempt
You need a date dimension that has an attribute like isHoliday.
Create a measure where you specify the color in the Hex Code format ("#A1A1A1")
for instance:
measure_color_coding_holiday = SWITCH ( TRUE (), 'Date'[IsHoliday] = "yes", "#808080", 'Date'[IsHoliday] = "No", "#FFFFFF" )
Go to the conditional formatting for the column > Background Color. Choose Field value and pick the new measure.
/Tom

How to use contains and replace in power query together?

I am trying to add a step in power query to replace any value "?" with UNKNOWN, but I need to add some sort of conditional or contains statement, and have not been able to figure out how to make it work.
Here is a sample of what the city values look like
and if I use something like this:
= Table.ReplaceValue(#"Uppercased Text","?","UNKNOWN",Replacer.ReplaceText,{"City"})
it will give results like
but I just want it to displace "UNKNOWN" once. I have been trying to combine the below with an if statement or contains, but not been able to make it work correctly.
If statement like this should work:
#"Replace" = Table.ReplaceValue(#"Uppercased Text", each [City], each if Text.Contains([City], "?") then "UNKNOWN" else [City], Replacer.ReplaceValue, {"City"})

How can I remove values from my Parent Grouping?

I would like to categorize questions as yes/no, but i dont want the values to show up on the parent row. Only the users row.
Is it best to setup a hierarchy on one table? Im still new to PowerBI. I want it structured liked the 1st screenshot.
[EXCEL]
[1]: https://i.stack.imgur.com/MztVg.png
[POWERBI]
[2]: https://i.stack.imgur.com/ugAI2.png
You can try with measure. DAX has function HASONEVALUE.
MeasureToTry =
if (hasonevalue(Table[Column]), 1, BLANK() )
Replace 1 depending on your logic.

CFCHART Title dynamically populated

I'm using CFCHART to generate awesome charts on the fly.
It would be nice to dynamically change the title of the chart based on selection criteria.... and I've been attempting to do that by setting a string, graphTitle, that conditionally populates based on selections. All I want to do is simply start a new line for each criterion.
For instance: Suppose I have a chart that has a large number of selection criteria in it. I would want the chart title to look like this: (Break, of course, indicates the end of a line)
Fiscal Year 2006 to projected 2013 (Break)
Hires of African American Heritage candidates (Break)
Whom are Female
From New Mexico, California, Texas and Colorado (Break)
With an Age of 29+ (Break)
With a breakdown of Degree Achievement:
I tried using the <SPAN> and <BR /> tags in the title. With no luck.
Any other ideas?
If you mean you want to add line breaks into the chart title so it "wraps" you might try adding ascii coded line breaks like so...
<Csfet linefeed = chr(10) & chr(13)/>
Then your variable would be
<cfset mytitle = "fiscal year 2006 to projected 2012 #linefeed# Hires of..."/>
And so on - you get the idea. Note: you might need "just" chr(10) or you might need both. you'll need to experiment. I don't "know" that this will work. If it were me and I wanted something that complex to decorate the chart I think I would draw a plain "undecorated" chart with only x and y axis labels present and then set up my title outside the chart using HTML. I would have better control that way.
Anyway if that doesn't work try fiddling with the "style" attribute. You can provide an XML () var with all sorts of options - but it is not well documented I'm afraid. Ray has some stuff on his blog regarding this.