Currently running query

select 
s.session_id,
r.status,
r.blocking_session_id,
SUBSTRING(st.text,(r.statement_start_offset/2)+1,
(
(
CASE r.statement_end_offset
when  -1
THEN Datalength(st.text)
else r.statement_end_offset
END -r.statement_start_offset
)/2
)+1) AS Statment_text,
COALESCE(Quotename(DB_Name(st.dbid))+N'.'+Quotename(object_schema_name(st.objectid,st.dbid))+N'.'+
QUotename(Object_name(st.objectid,st.dbid)),'') AS Command_text,
r.wait_type,
wait_resource
,r.wait_time/(1000.0) AS WaitTimeInSec,
r.cpu_time,
r.logical_reads,
r.reads,
r.writes,
r.total_elapsed_time/(1000.0) AS Elapsedtimeinsec,
r.command,
s.login_name,
s.host_name,
s.program_name
,s.host_process_id,
s.last_request_end_time
from sys.dm_exec_sessions as s
inner join SYS.dm_exec_requests AS r
ON r.session_id = S.session_id
Cross apply sys.dm_exec_sql_text(r.sql_handle) as ST
WHERE r.session_id <>@@SPID
--and r.status like '%runn%'
ORDER BY r.cpu_time
,r.status,
r.blocking_session_id,
s.session_id

Power BI

Adding an Index Column in Power Query Editor

An index column in Power Query Editor is used to add a new column with a sequential list of numbers to each row. These values can be used to uniquely identify each row.

The index column is similar to the Identity function in SQL Server. Just like the Identity function, the Index column option supports a start value and an increment value.

Let's understand how to add an Index Column to a table.

Step 1: Generate a Table with a List of Countries and Their Capitals Using ChatGPT.



























Step 2: To add an index column, select the table and navigate to the Index Column section under the Add Column tab. This section provides a dropdown menu with options to choose from:

From 0: Starts the index values from 0 and increments by 1.
From 1: Starts the index values from 1 and increments by 1.
Custom: This is the most commonly used option, allowing you to choose the start value and increment value.
Let's see this in practice.

From 0:































From 1:






























Custom : Here let us use 100 as the start value and 10 as the increment value. Follow the below steps to implement the Custom Index values.
  1. Select your table in Power Query Editor.
  2. Go to the Add Column tab.
  3. Click on the Index Column dropdown.
  4. Choose Custom.
  5. Set the start value to 100 and the increment value to 10.













































Under the Custome Option, It's not necessary to use only positive numbers; you can also use negative numbers. Here, we'll create a new index column with -1 as the start value and an increment value.























I hope this article helped you understand the creation and use cases of Index columns. If you have any doubts, please mention them in the comments section below.