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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous_001
Frequent Visitor

CALENDAR FUNCTION

hi Team,

Can measures be entered a input into the Calendar Function?

e.g. Calendar(<measure1>, <measure2>)

Thanks

9 REPLIES 9
parry2k
Super User
Super User

@Anonymous_001 not sure what I'm missing here, can you share the pbix file using one drive/google drive, remove sensitive information before sharing



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k @Any further suggestions?

Unfortunately, I'm unable to share file due to work IT restrictions.
Basically, there is one table with data extracted on different dates. I've called this the source column (Text Data type because the values are alpha numeric)
Below is the formula to calculate the 2 measures in the table which returns the old and recent date based on the user selection of source column slicer 

MAJOR = VAR SelectedSource1 = SELECTEDVALUE('TableA'[Source])
VAR FilteredTable1 = FILTER('TableA', 'TableA'[Source] = SelectedSource1)
VAR LatestDate = MAXX(FilteredTable1, 'TableA'[Calendar Week])
RETURN
LatestDate
MINOR =
VAR SelectedSource = SELECTEDVALUE('TableA'[Source])
VAR FilteredTable = FILTER('TableA', 'TableA'[Source] = SelectedSource)
VAR OldestDate = MINX(FilteredTable, 'TableA'[Calendar Week])
RETURN
OldestDate
[Calendar Week] is Date Data Type with format dd/mm/yy
Testing MINOR on Card Visual returns 21/08/23. Measure has format dd/mm/yy
Testing MAJOR on Card Visual returns 22/07/24. Measure has format dd/mm/yy
I'm trying to create Calendar table using MINOR and MAJOR as the 2 date inputs. The formula doesnt give any errors but returns a blank table.
parry2k
Super User
Super User

@Anonymous_001 weird, it should work, end date is greater than equal to the start date? Is it date or date/time?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k, the end date is greater than start date. This is the formula which returns blank values

CALENDAR([MINOR], [MAJOR])
MINOR is a calculated measure returning oldest date from data. Testing it on Card Visual returns 21/08/23. Measure has format dd/mm/yy
MAJOR is a calculated measure returning latest date from data. Testing it on Card Visual returns 22/07/24. Measure has format dd/mm/yy
parry2k
Super User
Super User

@Anonymous_001 can you put those measures in a Card visual to see if they are returning a date value?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

yes tried that & returns the correct date values

parry2k
Super User
Super User

@Anonymous_001 yes by all means.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

wow....that fills me with hope.

I've tried to use measure in Calendar function but returns blank calendar table

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.