We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Hi all,
Hope you can help me out converting a calculated column into a measure. Searched in the forum, but couldn't find a solution that worked well.
I created a calculated column in a data table called “Calendar”. It counts the open cases we had on each calendar date:
OpenCases = CALCULATE(DISTINCTCOUNT('SFDC CASE LIST'[Case Number]), FILTER('SFDC CASE LIST', 'SFDC CASE LIST'[Opened Date] < Calendar[Date]), FILTER('SFDC CASE LIST', 'SFDC CASE LIST'[Closed Date] > Calendar[Date] || 'SFDC CASE LIST'[Closed Date] = BLANK() ))
The calculated column works well. But when implementing in a visual, report filters are not applied on a calculated column. So tried to change this into a measure but failed, error message “A single value for column Date in table Calendar cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min… “
Measure = CALCULATE(DISTINCTCOUNT('SFDC CASE LIST'[Case Number]), FILTER('SFDC CASE LIST', 'SFDC CASE LIST'[Opened Date] < Calendar[Date]), FILTER('SFDC CASE LIST', 'SFDC CASE LIST'[Closed Date] > Calendar[Date] || 'SFDC CASE LIST'[Closed Date] = BLANK() ))
The idea is to create a visual (e.g. line chart) in Power BI and calculating the Measure for each date present in table “Calendar”. This date would be the axis of my visual.
Kind regards,
Tim
Solved! Go to Solution.
Hi @Tim_BE
This assumes no relationship between your Calendar and fact table:
OpenCases M =
VAR currentDate_ =
MAX ( Calendar[Date] )
RETURN
CALCULATE (
DISTINCTCOUNT ( 'SFDC CASE LIST'[Case Number] ),
'SFDC CASE LIST'[Opened Date] < currentDate_,
FILTER (
ALL ( 'SFDC CASE LIST'[Closed Date] ),
'SFDC CASE LIST'[Closed Date] > currentDate_
|| 'SFDC CASE LIST'[Closed Date] = BLANK ()
)
)
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
Hi @Tim_BE
This assumes no relationship between your Calendar and fact table:
OpenCases M =
VAR currentDate_ =
MAX ( Calendar[Date] )
RETURN
CALCULATE (
DISTINCTCOUNT ( 'SFDC CASE LIST'[Case Number] ),
'SFDC CASE LIST'[Opened Date] < currentDate_,
FILTER (
ALL ( 'SFDC CASE LIST'[Closed Date] ),
'SFDC CASE LIST'[Closed Date] > currentDate_
|| 'SFDC CASE LIST'[Closed Date] = BLANK ()
)
)
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 11 | |
| 10 | |
| 7 | |
| 7 | |
| 6 |