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
Madhan_
Frequent Visitor

How to calculate the new measure from another measure based on hour as category or group?

I want to create a success rate of mission by time.  The formula is = successful missions by time / total mission by time. For that I have already created a measure for the total mission by time 

 

Total Mission by Time = CALCULATE(count(space_missions[Mission]),ALLEXCEPT(space_missions,space_missions[Hour]))
 
and to filter only successful missions from the table  i created a measure
Successful Missions = CALCULATE([Total Missions],space_missions[MissionStatus]="Success")

 

From this, I want to calculate successful missions by time. For that, i don't know how to calculate a new measure called successful missions by time from the calculated measure of Successful missions based on hours as a group. Could you please help to resolve

 

capture_20221121113722360.jpg

1 ACCEPTED SOLUTION
v-yinliw-msft
Community Support
Community Support

Hi @Madhan_ ,

 

 

I use this as a sample data:

vyinliwmsft_0-1669102416442.png

 

You can try this method:

Create two measures:

SuccessMission =
CALCULATE (
    COUNTROWS ( 'space_missions' ),
    FILTER (
        'space_missions',
        AND ( 'space_missions'[MissionStatus] = "Success", 'space_missions'[Hour] )
    )
)
SuccessfulRate =
DIVIDE (
    'space_missions'[SuccessMission],
    'space_missions'[Total Mission by Time]
)

The result is:

vyinliwmsft_1-1669102416445.png

 

Hope this helps you.

Here is my PBIX file.

Best Regards,

Community Support Team _Yinliw

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yinliw-msft
Community Support
Community Support

Hi @Madhan_ ,

 

 

I use this as a sample data:

vyinliwmsft_0-1669102416442.png

 

You can try this method:

Create two measures:

SuccessMission =
CALCULATE (
    COUNTROWS ( 'space_missions' ),
    FILTER (
        'space_missions',
        AND ( 'space_missions'[MissionStatus] = "Success", 'space_missions'[Hour] )
    )
)
SuccessfulRate =
DIVIDE (
    'space_missions'[SuccessMission],
    'space_missions'[Total Mission by Time]
)

The result is:

vyinliwmsft_1-1669102416445.png

 

Hope this helps you.

Here is my PBIX file.

Best Regards,

Community Support Team _Yinliw

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Madhan_ , You can use date table and time intelligence

MTD Successful Missions= CALCULATE([Successful Missions],DATESMTD('Date'[Date]))
last MTD Successful Missions= CALCULATE([Successful Missions],DATESMTD(dateadd('Date'[Date],-1,MONTH)))

 

 

Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs&t=145s

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.

Top Solution Authors