Friday, 3 October 2025

Remove Filters on drill through Page

Step-1

    Create a Remove filter button as shown below


Step-2

    Create a bookmark to clear filter and update the bookmark with all the data in that page.



Step-3

    Tag that bookmark to the created button as shown below.



Step-4

    Now, after the drill through is applied, you can go the page and click

    on remove filters to remove the drill through filter and show all the data.









Filter pane in bookmarks

 



    Once Slicer is selected and Close button is clicked, Then the filter is not reflect Since we need to make some changes in the bookmark as shown below


Step-1

    Click on the bookmark which is pointing for Close Button.






Step-2

    Uncheck the data as shown below




Power BI One Slicer to filter other slicers based on Items that has value only without BI Direction



Ref Video : 

https://www.youtube.com/watch?v=cyOquvfhzNM

https://www.youtube.com/watch?v=MeLaZFst02E


Step-1

    Create a measure like below.

Cascading=

   COALESCE(DISTINCTCOUNT('table'[ID]),0)

Step-2
    Put the created measure in this in this visual section of slicer pane as shown below


Step-3
    Now in the filter slicer only the relevant data related to the another selected slicer will only appear.


Sunday, 28 September 2025

Python code to compare Blog files vs filesnames in sql server

 import pandas as pd

from azure.storage.blob import BlobServiceClient
import pyodbc

# ------------------ Azure Blob Storage Configuration ------------------
blob_connection_string = 'COnncetionstring'
blob_container_name = 'Blobcontainer Name'

# Connect to Blob Storage
blob_service_client = BlobServiceClient.from_connection_string(blob_connection_string)
container_client = blob_service_client.get_container_client(blob_container_name)

# Fetch file names from Blob Storage
blob_file_names = [blob.name for blob in container_client.list_blobs()]
df_blob_files = pd.DataFrame(blob_file_names, columns=['FileName'])

# ------------------ Azure SQL Database Configuration ------------------
sql_server = 'Server Name'
sql_database = 'Databse'
sql_username = 'user name'
sql_password = 'password'
sql_driver = 'ODBC Driver 17 for SQL Server'
sql_table = 'FileName table'

# Connect to SQL Server and fetch file names
sql_conn_str = f'DRIVER={sql_driver};SERVER={sql_server};DATABASE={sql_database};UID={sql_username};PWD={sql_password}'
sql_query = f'SELECT B2BFileName FROM {sql_table}'

with pyodbc.connect(sql_conn_str) as conn:
df_sql_files = pd.read_sql(sql_query, conn)

# ------------------ Comparison Logic ------------------
# Find files in Blob Storage that are not in SQL Server
missing_files = df_blob_files[~df_blob_files['FileName'].isin(df_sql_files['B2BFileName'])]

# ------------------ Export to Excel ------------------
output_file = r'C:\Users\Desktop\MissingBlobFiles.xlsx'
missing_files.to_excel(output_file, index=False)

print(f"Missing file names exported to: {output_file}")



3. .isin(...)

This method checks whether each value in df_blob_files['FileName'] exists in the list of values from df_sql_files['B2BFileName'].

It returns a boolean Series — True if the file name exists in SQL Server, False if it doesn't.

4. ~ (Tilde Operator)

This is a logical NOT operator. It inverts the boolean Series returned by .isin(...).

So now, it marks True for file names not found in SQL Server.