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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

My measure can only work if I display the fields it uses

Hello, I have already posted a message on the first part of my problem. The solution that was given worked for me, it was exactly the answer I had asked for.

The problem is that, at the time I didn't realise doing what I wanted will cause a new problem.

My original post can be found here: By row, search for a value in another row of the same table

 

I have a measure that allows me to calculate the duration between the transition date of my current row, and the transition date of the previous transition.

If I display all fields in a table, the measure works just perfectly.

The problem is that if I want to create a visualization of my measure by Status, for example, it won't work because the required fields are not part of the visualization.

 

IdTransitionnedFrom StatusTo StatusIssue IdCreatedEXPECTED Duration
1782442017-01-13 9:41OpenIn Analysis264962017-01-11 13:112
1782452017-01-13 9:41In AnalysisTo Do264962017-01-11 13:110
1800052017-01-20 9:46OpenIn Analysis265662017-01-13 16:297
1800062017-01-20 9:47In AnalysisTo Do265662017-01-13 16:290
2027032017-04-06 14:31To DoValidation265662017-01-13 16:2976
2027062017-04-06 14:33ValidationTo Do265662017-01-13 16:290
2094202017-04-28 16:38To DoIn Progress265662017-01-13 16:2922
2094212017-04-28 16:38In ProgressValidation265662017-01-13 16:290
2094442017-04-28 16:48ValidationIn Progress265662017-01-13 16:290
2111502017-05-04 15:53In ProgressDone265662017-01-13 16:296
2111512017-05-04 15:53DoneValidation265662017-01-13 16:290
2132292017-05-10 17:09ValidationDone265662017-01-13 16:296
2153952017-05-18 13:57To DoDone264962017-01-11 13:11125
2165582017-05-24 13:38DoneValidation264962017-01-11 13:116
2166912017-05-24 16:20ValidationDone264962017-01-11 13:110
2345802017-08-04 15:51OpenDevelopment306812017-08-02 17:352
2345812017-08-04 15:51DevelopmentCompilation306812017-08-02 17:350
2348052017-08-07 9:44To DoDone307122017-08-07 8:280
2354472017-08-08 15:41CompilationQA Pre-Production306812017-08-02 17:354
2359102017-08-10 17:22QA Pre-ProductionQA Production306812017-08-02 17:352
2359152017-08-10 17:25QA ProductionDone306812017-08-02 17:350

 

Here's the measure that I used : 

Duration (d) = 
	VAR PreviousTransitions = 
		FILTER(
			ALLEXCEPT(
				'JIRA Changelogs',
				'JIRA Changelogs'[Issue Id]
			),
			'JIRA Changelogs'[Id] < SELECTEDVALUE('JIRA Changelogs'[Id]) 
		)
	VAR PreviousStepTime =
		CALCULATE(
			MAX('JIRA Changelogs'[Transitionned]),
			PreviousTransitions
		)
	RETURN
		DATEDIFF(
			IF(
				ISBLANK(PreviousStepTime), 
				SELECTEDVALUE('JIRA Changelogs'[Created]), 
				PreviousStepTime
			),
			SELECTEDVALUE('JIRA Changelogs'[Transitionned]),
			DAY
		)

 

Please find attached a sample pbix file with the expected result. I don't need to use a measure, if there's a better solution by adding a column, it's okay with me.

 

Sans titre.png

 

Thanks a lot in advance, your help is much appreciated!

1 ACCEPTED SOLUTION

Hi @Anonymous

 

Try this calculated column. This is equivalent of the MEASURE above

 

Duration (c) =
VAR PreviousTransitions =
    FILTER (
        ALLEXCEPT ( 'JIRA Changelogs', 'JIRA Changelogs'[Issue Id] ),
        'JIRA Changelogs'[Id] < EARLIER ( 'JIRA Changelogs'[Id] )
    )
VAR PreviousStepTime =
    CALCULATE ( MAX ( 'JIRA Changelogs'[Transitionned] ), PreviousTransitions )
RETURN
    DATEDIFF (
        IF (
            ISBLANK ( PreviousStepTime ),
            'JIRA Changelogs'[Created],
            PreviousStepTime
        ),
        'JIRA Changelogs'[Transitionned],
        DAY
    )

 


Regards
Zubair

Please try my custom visuals

View solution in original post

4 REPLIES 4
WolfBiber
Employee
Employee

Hey,

are you trying to visualize timedurations ?

Have a look to "events in progress"

A good starting point is here:

https://community.powerbi.com/t5/Desktop/Count-of-Active-Contracts-by-Start-en-End-date/td-p/94104

Greetings,

Wolf

Hi @Anonymous

 

Try this calculated column. This is equivalent of the MEASURE above

 

Duration (c) =
VAR PreviousTransitions =
    FILTER (
        ALLEXCEPT ( 'JIRA Changelogs', 'JIRA Changelogs'[Issue Id] ),
        'JIRA Changelogs'[Id] < EARLIER ( 'JIRA Changelogs'[Id] )
    )
VAR PreviousStepTime =
    CALCULATE ( MAX ( 'JIRA Changelogs'[Transitionned] ), PreviousTransitions )
RETURN
    DATEDIFF (
        IF (
            ISBLANK ( PreviousStepTime ),
            'JIRA Changelogs'[Created],
            PreviousStepTime
        ),
        'JIRA Changelogs'[Transitionned],
        DAY
    )

 


Regards
Zubair

Please try my custom visuals
Anonymous
Not applicable

Thanks @Zubair_Muhammad, that works perfectly. That's amazing how simple it was. I was able to use the Created value that is in another table by using RELATED.

That's perfect !

 

Thanks again, that was quick and very efficient !!

@Anonymous

 

954.png


Regards
Zubair

Please try my custom visuals

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.