Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
I am trying to get distinct key running count based on product Type. where the end date must take from date slider and start date should be static to first day in date table even though user adjust the start date. uploaded pbix & Excel files with sample data & business expecations scenarios in below link:
Any help is much appreciated !!
Thank you
Solved! Go to Solution.
Hi @Anonymous ,
Believe that your data is not correctly calculated since if you look only at 36528 you have the lines below:
3 of the lines are before January 15 and you have two distinct ProductKEY in your summary you are presenting only 1 so if you can confirm the data on the filtered data would be great.
Regarding your issue believe you would be better serve using a before slicer that way people would not be abble to change the start date but having this has you have you can write your measure in the following way:
Distinct key Running count =
CALCULATE (
DISTINCTCOUNT ( 'Table'[Product Key] );
FILTER (
ALL ( 'Table'[Invoice Date] );
'Table'[Invoice Date] <= MAX ( 'Date'[Date] )
);
USERELATIONSHIP ( 'Date'[Date]; 'Table'[Invoice Date] )
)
When you making a reference to the entire table has you have previously the context picks up all the line values and all the columns so when you take out some columns from your data you will get 9 for every single row. This has to do with the use of measures and their context.
One further question if you activate the relationship there is no need for the use relationship, and if you use that with the before slicer there isn't a need for a measure you can use the column Product Key directly.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @Anonymous ,
Believe that your data is not correctly calculated since if you look only at 36528 you have the lines below:
3 of the lines are before January 15 and you have two distinct ProductKEY in your summary you are presenting only 1 so if you can confirm the data on the filtered data would be great.
Regarding your issue believe you would be better serve using a before slicer that way people would not be abble to change the start date but having this has you have you can write your measure in the following way:
Distinct key Running count =
CALCULATE (
DISTINCTCOUNT ( 'Table'[Product Key] );
FILTER (
ALL ( 'Table'[Invoice Date] );
'Table'[Invoice Date] <= MAX ( 'Date'[Date] )
);
USERELATIONSHIP ( 'Date'[Date]; 'Table'[Invoice Date] )
)
When you making a reference to the entire table has you have previously the context picks up all the line values and all the columns so when you take out some columns from your data you will get 9 for every single row. This has to do with the use of measures and their context.
One further question if you activate the relationship there is no need for the use relationship, and if you use that with the before slicer there isn't a need for a measure you can use the column Product Key directly.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em Portuguêsyes, its 2 unique product keys. i twisted a logic little bit and worked as i expected.
Thanks you Miguel, you are awesome !!
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
70 | |
68 | |
43 | |
34 | |
26 |
User | Count |
---|---|
86 | |
50 | |
45 | |
38 | |
38 |