Forum Discussion
Notebook with sempy - giving a date range for filters
- Anonymous2 years ago
Hi anandfarmers ,
Apologies for the delay in reply from our side.fabric.evaluate_measure has the limitation of the filter that only suppors the 'in' operator.
If you are looking towards range operation then i recommed to use fabric.evaluate_dax .
For eg:import sempy.fabric as fabric df_dax = fabric.evaluate_dax( "Customer Profitability Sample", """ EVALUATE SUMMARIZECOLUMNS( 'State'[Region], 'Calendar'[Year], 'Calendar'[Month], 'State'[State], FILTER('Calendar', 'Calendar'[Year] >= 2009 && 'Calendar'[Year] <= 2011), ) """) df_dax
Inorder to get some idea please refer below link,
Read data from semantic models and write data that semantic models can consume - Microsoft Fabric | Microsoft Learn
FILTER function (DAX) - DAX | Microsoft Learn
Hope this is helpful. Please let me know incase of further queries.
Hi anandfarmers ,
Apologies for the delay in reply from our side.
fabric.evaluate_measure has the limitation of the filter that only suppors the 'in' operator.
If you are looking towards range operation then i recommed to use fabric.evaluate_dax .
For eg:
import sempy.fabric as fabric
df_dax = fabric.evaluate_dax(
"Customer Profitability Sample",
"""
EVALUATE SUMMARIZECOLUMNS(
'State'[Region],
'Calendar'[Year],
'Calendar'[Month],
'State'[State],
FILTER('Calendar', 'Calendar'[Year] >= 2009 && 'Calendar'[Year] <= 2011),
)
""")
df_dax
Inorder to get some idea please refer below link,
Read data from semantic models and write data that semantic models can consume - Microsoft Fabric | Microsoft Learn
FILTER function (DAX) - DAX | Microsoft Learn
Hope this is helpful. Please let me know incase of further queries.
Thank you for the reply.
It calrifies different use cases of the functions.
- Anonymous2 years agoNot applicable
Hi anandfarmers ,
Glad to know that your query got resolved. Please continue using Fabric Community for your further queries.