cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

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
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors