Reading columns dynamically from Excel in Power Automate - power-automate

I have an excel file with key columns and also 365 columns with dates as header in different columns for whole year, My requirement is to read key columns and also the date column which equals to current day only.
For example when Power Automate workflow runs on 10th Jan, it should read the date under the column - 10th Jan only . Not other columns like 9th or 11th Jan. Next day it should read 11th Jan and so on.
Is it possible to automate such scenarios in power automate. How can I enable power automate flow to read different columns in excel
Thanks
Siva.
I tried all the options to choose dynamic columns, couldn't find any option in power automate to do it.

Related

Excel Power Query storing the old data in a column

In excel power query I have a linked excel file where only the last column is updated by the team. For example is the cut-off data day is Jan 13th then the data is titled Jan 13 and the rows are updated for this week. When the update is done the following week, the column header is changed to Jan 20. How can I keep the old data for Jan 13th in power query so that I only get the new data in a new column when refreshed?
I tried but I am stuck
PowerQuery doesn't store any data, it's essentially a transformation script, that uses whatever is in the linked source when refreshed. So if the data for 13th is gone at the source it will be gone in PowerQuery too. If the column for 20th is added next to column for 13th, then you can create a dynamic logic that would keep more columns.
You could create a logic preserving the historical data using VBA (to store it in the not linked table), but in Excel & M it is not possible. With PowerBI there is an option of incremental refresh that potentially could be used here, but it's not available in Excel

Microsoft Power BI, DAX - tricky ALLSELECTED with 2 values in slicer, but show only TOP 1 row in visual

This question is an extension of an already answered question, which I posted this week.
I have the below situation in Microsoft Power BI.
I have 2 simple tables:
1) CountryTable
2) YearTable
There is a 1-M relationship between YearTable and CountryTable.
The latter (YearTable) is used to feed values into a slicer.
(In my client database, Year has some alphabetical prefixes, such as Q1-2022, so I prefer to use YearOrder column to sort the Year column at the backend, while the slicer will display the Year column.)
The former (CountryTable) is the main table, with just a few sample rows.
These two tables are related via the Year column.
The Year slicer always has EXACTLY 2 values chosen in my Power BI report.
I need the Maximum of these two values of the year slicer as a measure, for each row of my visual.
At the same time, these two year values of the slicer must remove the unwanted rows in my report visual, based on the slicer selection of year values.
For example, when the slicer has 2019 and 2020 chosen, I need the value as in the DesiredOutput1 page.
Similarly, you can see DesiredOutput2 (Slicer values are 2020 and 2022); DesiredOutput3 (Slicer values are 2019 and 2022) pages.
I have indeed successfully obtained DesiredOutput1, DesiredOutput2, DesiredOutput3. Thanks to all the folks who helped me attain this.
Now, my main requirement in this posting, is this:
After obtaining the DesiredOutputs above, I need the following output:
Show only the TOP 1 row (ASC order of Year column, which is the minimum value of the slicer).
Essentially:
Year column of the visual: Minimum value of the slicer
MaxYear_Measure_SlicerSelection: Maximum value of the slicer (maximum of the two values chosen in the slicer)
You can see below:
Note: MaxYear_Measure_SlicerSelection measure can refer to any one of the two measures [MaxYear] or [MaxYearMeasure_Community] (see the .pbix file for the formulas of the measures).
Any idea ?
I prefer the Year column of the visual not to be converted to a new measure. Would RANKX help in this case ? Any thoughts?

Building a matrix with columns == days of month when recordset cannot return all days of month

I'm trying to put together an attendance report for a school that tracks student attendance codes for that student for every day on the calendar month in a DynamicsCRM system being used as a managed service (that is to say, I build queries using FetchXML and cannot use SQL). The format for the report requires that a column for every day in the month be listed for the report. My student table that tracks this attendance however only contains records for days where an attendance value is recorded, and I do not have an object available that can return every day in a month for me.
I am looking for a solution other than hardcoding 31 columns and using conditionals to control the display of the last three day columns. Ideally, I'd like a conditional in my matrix column grouping that would look at the date value for the previously generated column and determine if the next date record from my resultset is sequentially the next day of that month, and if not, create the next sequential date, move to the next column and perform the check again until it is true. Is there a way I can do this, or another means to accomplish my goal that does not involve hard-coding day columns into a table or matrix? Right now, I have nothing; I can barely imagine how I think this should look.
What I did to solve the same issue has been to create a scheduled process each day to create a record and deactivate it.
I have then been able to distinguish actual records (the active ones) from these 'placeholders' (inactive ones) in my querying.

Oracle SQL Output to Excel - Date format issue

I ran an SQL Query for Oracle which consists of Invoice date and Check date. When these data are copied on to an Excel Spreadsheet as text, it's dispayed as ex: "13-10-31" (Oct 31, 2013). However, when converted to date format, it's displayed as "10/13/1931". I've tried different date types but it always recognizes as the first part of the text as the day, then month, then year. I need these values to be setup as a date format as I need to calculate Days Payable Outstanding and other related ratios.
Is there any way to convert these values so that Excel recognizes the day, month, and year correctly? Would there be a macro that could automate this process for existing data and data that will be added in the future?
Thank you in advance.
Firstly, I hope the data type of your date column is DATE.
Secondly, the date should always have year as YYYY and not just YY. The world has already learned from Y2K bug.
If above two points are met, then while displaying use to_char(date_column, 'mm/dd/yyyy'). Thus, with YYYY format, there won't be any confusion between year and other fields.

Excel 2010 - Find Records With Last Date Prior to Given Time

I have a spreadsheet with a list of users and all the timestamps for their logins for the past two years. I want to find all the users who have not logged in for specified periods of time -- say, not within the past month, not within the past two months.
How can I do this?
The data are in two columns, user ID and login date/time stamps.
user1 11/3/10 13:21
user1 1/3/11 12:54
user1 1/23/11 9:58
user2 10/2/10 10:13
...
Date and time are a single column.
I can see how to find, say users that logged in prior to a particular date but not how to exclude at the same time, those who logged in after that date.
Any help would be much appreciated.
Thanks.
mp
Here is a link to a UDF that would be very helpful in this situation:
http://www.ozgrid.com/Excel/find-nth.htm
It will work basically like a VLOOKUP, but is not limited to only finding the first instance of something. For example, to find the date of the last instance of a certain user (assuming the reference sheet is all in chronological order), build a spreadsheet with 3 columns, one with a unique list of usernames, one with the total number of occurrences, and the third column with the Nth_occurrence formula to return the date of the last occurrence.
number of occurances formula:
=COUNTIF(Sheet1!$A:$A,A1)
formula for third column:
=Nth_Occurrence(Sheet1!A:A,A1,B1,0,1)
You can then compare this last date to see if it falls within the last week, month, etc.
Of course, if you are against UDFs, you could accomplish nearly the same goal by re-sorting your sheet in reverse-chronological order and then just using VLOOKUP, which would of course only find the first instance (which would be the most recent). But this is not nearly as smooth ;-)

Resources