Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Rakeshss
Frequent Visitor

Converting the below dax as Parameter to limit the data in calendar table

Hi Team,

 

I have a Dim_Calendar table and I want to filter my calender to limit the data, the start date for the calendar is a dynamic value picking from other table the Dax is as below where I am getting the required output, this same output should be used as filter as shows below and this out put should be dynamic.

Rakeshss_0-1709625802437.png

 

VAR _MaxSnapShotDate = MAX(EU_OMP_PROD_LOC_PLANVIEW_DAILY_FACT[SNAPSHOT_DATE])
VAR _MaxSnapShotDateWeekenDate = WEEKDAY(_MaxSnapShotDate,2)
VAR Result =
SWITCH(TRUE,
_MaxSnapShotDateWeekenDate = 1,_MaxSnapShotDate +6,
_MaxSnapShotDateWeekenDate = 2,_MaxSnapShotDate +5,
_MaxSnapShotDateWeekenDate = 3,_MaxSnapShotDate +4,
_MaxSnapShotDateWeekenDate = 4,_MaxSnapShotDate +3,
_MaxSnapShotDateWeekenDate = 5,_MaxSnapShotDate +2,
_MaxSnapShotDateWeekenDate = 6,_MaxSnapShotDate +1,
_MaxSnapShotDateWeekenDate = _MaxSnapShotDate)
Return
Result-125

 

I want to convert this dax as paramenter and filter my date table.

 

 

Thanks !

Rakesh

2 REPLIES 2
v-shex-msft
Community Support
Community Support

HI @Rakeshss,

Did you mean to create a dynamic calculated table/column based on filter effect? AFAIK, current power bi does not support these. They work on different levels, and you can't use the child level to affect the parent level.

Notice: the data level of power bi(from parent to child level)

Database(external) -> query table(query, custom function, query parameters) -> data model table(table, calculate column/table) -> data view with virtual tables(measure, visual, filter, slicer)

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
some_bih
Super User
Super User

Hi @Rakeshss one possible solution is to create Calendar / Date table with DAX as shown on link

In that example column Sales[Order Date] is used to create Min and Max date so in your case apply your column/s





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.