Saturday, May 28, 2022

SQL To get Row count in all table

 CREATE TABLE #counts

(
    table_name varchar(255),
    row_count int
)

EXEC sp_MSForEachTable @command1='INSERT #counts (table_name, row_count) SELECT ''?'', COUNT(*) FROM ?'
SELECT table_name, row_count FROM #counts ORDER BY table_name, row_count DESC
DROP TABLE #counts

Tuesday, May 17, 2022

我們無法阻止別人遺棄我們

我們無法阻止別人遺棄我們,

但別認為自己是被留下來的那一個,

你可以朝另一個方向走去,

選擇不一樣的人生和自己。


別人越看不起,就會變得越堅強,
儘管許多人不得已或是不需要我而遺棄我,
我都必須對自己的人生負責,
每個人都有自己的路要走,
對方只是選擇了沒有我存在的那條路。

我相信沒有對方在的那條路,
我一樣可以展現最好的自己,
讓自己不受任何事影響自己前進的道路。

Tuesday, May 3, 2022

Power BI Count rows

 


Using above code, you will get correct recency range filter with correct recency value as below. 
















If COUNTROWS is pass in as variable as pre-calculated value, this will result in incorrect result. 







Thus from the observation, you know that DAX programming is not procedural in some of the function.

The COUNTROWS function will iterate through each rows of the table and perform calculation, so it is very important that this function is not use in too big NESTED environment.