How to replace the value in same colomn - power bi query editor - powerbi

I got bellow query table, now i need one more column that would show all the latest value of unit id which is the true value of the Custom and currentUnit column
data table image
expected result would be in the image
expected result image
Any help please!

Copy currentUnit to New
Replace false with null
Transform - Fill up
Replace value with null where custom = True
Provide sample data in copyable format if you need more detailed instructions

Related

how to make pivot table using Xlwings?

Would you let me know how to make the pivot table in excel using xlwings?
please give me the sample code
Thanks for your help
I have tried to find how to make it but I couldn't find it
Creating a PivotTable with xlwings is not currently straightforward, and requires the use of the .api to access the VBA functions.
An example to create a PivotTable using my mock data in a Table called Table1 of 3 columns of data with headers: "Colour", "Type", "Data".
# set the kwarg values for creating PivotTable
source_type = xw.constants.PivotTableSourceType.xlDatabase
source_data = wb.sheets["Sheet1"]["Table1[#All]"].api # cannot be of type Range or String
table_destination = wb.sheets["Sheet1"]["A20"].api # cannot be of type Range or String
table_name = "PTable1"
# create PivotTable
wb.api.PivotCaches().Create(SourceType=source_type,
SourceData=source_data).CreatePivotTable(
TableDestination=table_destination,
TableName=table_name)
pt = ws.api.PivotTables(table_name)
# Set Row Field (Rows) as Colour column of table
pt.PivotFields("Colour").Orientation = xw.constants.PivotFieldOrientation.xlRowField
# Set Column Field (Columns) as Type column of table
pt.PivotFields("Type").Orientation = xw.constants.PivotFieldOrientation.xlColumnField
# Set Data Field (Values) as Data
pt.AddDataField(pt.PivotFields("Data"),
# with name as "Sum of Data"
"Sum of Data",
# and calculation type as sum
xw.constants.ConsolidationFunction.xlSum)
Additional Detail
For reason of xlDatabase source_type, the VBA documentation can be found here
The parameters can be seen in the VBA documentation here. And this tutorial provides a detailed explanation of these, along with how to change this for different scenarios (dynamic range, in a new workbook, etc.); the guide gives a couple of additional changes to the formatting of the values, such as position of fields and number format.
The options for type of data calculation can be found here.

Adding label in AutoML for text classification

I am trying to create a text dataset in a Pipeline for a text classification but I believe I am doing it the wrong way or at least I don't get it. The csv passing only contains two columns message and label which is true or false.
Inside my pipeline I am creating dataset like this which I am not very sure how dataset is recognizing that column label is the independent variable.
dataset = gcp_aip.TextDatasetCreateOp(
project = project # my project id,
display_name = display_name # reference name,
gcs_source = src_uris # path to my data in gcs,
import_schema_uri = aiplatform.schema.dataset.ioformat.text.single_label_classification,
)
once created the dataset, i do training like this within the Pipeline
# training
model = gcp_aip.AutoMLTextTrainingJobRunOp(
project = project,
display_name = display_name,
prediction_type = "classification",
multi_label = False,
dataset = dataset.outputs["dataset"],
)
Not sure if creation and training is doing correctly since I never specified that label is my label column and needs to use message as a feature.
In vertex ai the dataset created look like this
But in my training section the results from the AutML, looks like this, dont know why, label with 0% is there, which makes me doubt about the insertion of the data
In preparation of CSV file, you don't need to specify which column is the feature and the label. Vertex AI's AutoML automatically reads the first column as the feature and the second column as the label. You may refer to this documentation for more details in preparation of CSV data.
Below is sample CSV file, all values under first column(column A) are detected to be the feature and all values under second column(column B) are the labels.
You might need to check your CSV file and search for the word "label" on your second column and replace it with either "True" or "False" since based on your given data, you are only trying to have 2 labels which are "True" and "False". In addition, if you find the word "label" on your 2nd column and it doesn't have a value on its first column, then you just need to just remove the word "label".
In your provided screenshot here, there is a 1 count for the word "label", which means there is a "label" value existing on the 2nd column of your CSV data.

Oracle apex grid calculations to_number hampering DA

I have another requirement where the grid query is:
select to_char(kpi_1,'999,999,999,999.99'), to_char(kpi_2,'999,999,999,999.99'), to_char(kpi_3,'999,999,999,999.99') from kpi;
The KPI_1,KPI_2,KPI_3 columns are float in database but on grid they need to be represented in comma separated format. Therefor to_char is used.
And in processing they are changed back to to_number format to store in database.
Now i need to add dynamic action that would be kpi_2-kpi_1 = kpi_3.
So when i use dynamic action, set value: KPI_2-KPI_1, nothing happens.
Also when i use: to_number(kpi_2,'999,999,999,999.99') - to_number(kpi_1,'999,999,999,999.99')
For values input there/existing data, there is no change in kpi_3 column which should have been calculated.
What am i doing wrong here?
Try to return to_number(kpi_2,'999,999,999,999.99') -to_number(kpi_1,'999,999,999,999.99') value using debug or in plsql raise_applicaiton_error.
if value return then try to set value using set value dynamic action.

How can I ouput the values of a column (values() function) as a list in DAX for Power BI?

I use Power BI to create reports and visuals for large enterprise clients.
I have an interesting request from one of my clients: they would like to be able to see a summary of all filters that are applied to a given report. I used the ISFILTERED() function to create a card visual that lists the dimensions that are filtered, but they would like to be able to see which values are being shown. This works just fine when they have sliced or filtered for just one value, but how can I show when more than one is selected? My DAX is below:
Applied Filters =
var myvalues = VALUES(mytable[dimension_column])
return
IF(ISFILTERED(mytable[dimension_column]) = FALSE(),
"Not filtered",
"Column Name:" & UNICHAR(10) & mylist)
When only one value is selected in the slicer, the output is:
Column Name:
Selected Value
Obviously, when more than one value is selected in the slicer, variable mylist will have more than one value and the function fails. My question is, how can I convert the column myvalue to a list in DAX, so I can output each and every value?
What I want to get is:
Column Name:
Selected Value1,
Selected Value2,
etc.
Thank you!
One possibility is to concatenate all the values into a single string.
For example, you'd replace mylist with the string
CONCATENATEX(VALUES(mytable[dimension_column]), mytable[dimension_column], UNICHAR(10))
You're really only returning a single value for the measure, but it looks like a column.
Another approach is, instead of using a card, to simply create a table visual that just has mytable[dimension_column] for the values. This table will automatically filter as you adust slicers.

How to query sharepoint search api where column value contains space

I am trying to run a SharePoint api query to match against a column with a specific value.
The column value contains a space which is resulting in the query not working as expected. Returning anything with 'value' in the column rather than just items where the column = 'value 2'.
My current url looks like where $listId is a list guid
https://mysite.sharepoint.com/_api/search/query?querytext='(customColumn:value 2)+AND+(ListID:$listId)'&selectproperties='Name,Title,Description,Author,LastModifiedTime,Path'
What is the syntax for
(customColumn:value 2)
That allows me to only return results where customColumn = "value 2"?
Try to encode the endpoint as
_api/search/query?querytext='customColumn:value%202'
My test Sample:
/_api/search/query?querytext='Title:Developer%20-%20Wiki1 Author:Lee'