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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

Dynamic Date Measure to filter the total number of licences which are only valid between dates

Hey everyone,

 

I couldn't solve a problem so I decided to ask for your help.

 

Currently, I am dealing with a data that has user names, and a certification type that is associated to each user. A certificate is only valid between specific dates (i.e. 05 March 2019-14 September 2023). Also, there are 5 types of certificates. 

 

I would like to draw a graph showing the cumulative sum of certificates available at the beginning of each month, with a certificate type breakdown. I tried to write a formula to calculate the cumulative sum, yet it is not dynamic adjusting the cumulative sum with respect to changing range of x-axis; which is the date in my case. 

 

Have you formulized such a problem before? If so, I would really appreciate your help.

 

Kind Regards,

Murat

1 REPLY 1
Anonymous
Not applicable

 

// Fact: Certification Info
// Dimensions with the type of connection:
// User 1:* Certification Info
// Certificate 1:* Certification Info
// Date (not connected to Certification Info)
// Certificate Type must be the attribute of Certificate
// and not be stored int the fact table.
//
// Assumptions:
// Date should be a Date table in the model.
// UI slicing only through dimensions.
// All columns in the fact table are hidden.

// This measure will grab the very first date
// visible in the currently selected period,
// (if you select jan 2020, it'll be
// 1st jan 2020) and calculate the number
// of certificates that were valid on this
// very day.
//
// If you connect Date to the fact table,
// this formula should be written differently.
// Here, the assumption is that no column in
// the fact table is exposed to the user. This
// is how it should be. If you decide to have
// a calendar connected to either of the fields,
// ValidFrom, ValidTo, the formula will not
// work correctly.
[# Cert At Period Start] =
var __firstDate = FIRSTDATE( Date[Date] )
var __certCount =
	CALCULATE(
		COUNTROWS( 'Certification Info' ),
		'Certification Info'[ValidFrom] <= __firstDate,
		'Certification Info'[ValidTo] >= __firstDate
	)
return
	__certCount

 

It's easy to get this measure by Cert Type and Periods (be it months or years or... whatever you define in Date). Just drag the attribute from the Certificate dimension onto somewhere....

 

Best

D

 

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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