Forum Discussion
Handling multiple dates with one date picker in semantic model
Good day all
We are creating dashboard using Semantic model in power BI, we have two columns one when record is created on and another record modified on.
Could you please advise what could be the effective way to create a date picker on main dashboard which will filter data out of those two columns. We are unable to use the parameter option as it is grey out.
Urgent response is highly apperciated.
Regards
Mohit Jain
Unpivot Created On and Modified On into single EventDate + EventType columns in Power Query.
Date table connects to EventDate. One slicer filters both. Measures use IF(EventType = "Created", [count], [count]).
8 Replies
- Kedar_Pande
Super User
Unpivot Created On and Modified On into single EventDate + EventType columns in Power Query.
Date table connects to EventDate. One slicer filters both. Measures use IF(EventType = "Created", [count], [count]).
- grazitti_sapna
Super User
Hi jainmohit0710 ,
Assuming you already have a Date table created in the semantic table
You can proceed further like this
Create a Selection table
Date Type =
DATATABLE(
"Type", STRING,
{
{"Created Date"},
{"Modified Date"}
}
)Now Create a measure for fltering your data
Selected Date Filter =
VAR SelectedType = SELECTEDVALUE('Date Type'[Type])
RETURN
SWITCH(
SelectedType,
"Created Date",
CALCULATE(
COUNTROWS(FactTable),
TREATAS(VALUES(DateTable[Date]), FactTable[CreatedDate])
),
"Modified Date",
CALCULATE(
COUNTROWS(FactTable),
TREATAS(VALUES(DateTable[Date]), FactTable[ModifiedDate])
)
)-
Add slicer: (Your calendar table)
DateTable[Date] -
Add slicer:
-
Date Type[Type]
Now use "Selected Date Filter" in your visuals.
🌟 I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.
💡 Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.
🎖 As a proud SuperUser and Microsoft Partner, we’re here to empower your data journey and the Power BI Community at large.
🔗 Curious to explore more? [Discover here].
Let’s keep building smarter solutions together! -
- jainmohit0710New Member
Per my understanding that will work for seperate pages , will this work for KPI card drag to show case total on summary dahsboard shoing both record count.
Regards
Mohit
- grazitti_sapna
Super User
Hi
Your understanding is partly correct, but let me clarify precisely how this behaves in Power BI.
- If user selects Created Date → KPI shows count based on CreatedDate
- If user selects Modified Date → KPI switches to ModifiedDate
Works perfectly on:
- KPI cards
- Charts
- Tables
If nothing is selected on Data type slicer it will return the default count of values depending upon the active relationship. Just make a slight change to below variable (Assuming created date is your default active relationship)
VAR SelectedType = SELECTEDVALUE ('Date Type'[Type], "Created Date")
If you want instead of showing the default active relationship count you want sum of both (modified and created date), then you can add another condition to the Dax that if data type is deselected or both are selected then show sum of both the variables, which we created in the Dax i shared
making these changes should fix your issue, Let me know what is you require any further assistance
🌟 I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.
💡 Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.
🎖 As a proud SuperUser and Microsoft Partner, we’re here to empower your data journey and the Power BI Community at large.
🔗 Curious to explore more? [Discover here].
Let’s keep building smarter solutions together!- jainmohit0710New Member
is theer any way we can handle both create date and modified date card and detailed tab seperately. As KPI card is seperate on summary page which will show data seperate for modified date and create date. As a next part when some click on that KPI card that will take them to the specific detailed tab.
So can we control the same with one date picker?
Regards
Mohit
- AnonymousNot applicable
Hi jainmohit0710 ,
I would also take a moment to thank Kedar_Pande , for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference.
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions
- AnonymousNot applicable
Hi jainmohit0710 ,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.