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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Syndicate_Admin
Administrator
Administrator

Three metrics in one

Hi, I have a problem in my metrics work that I can't figure out, I need your help. 🙏

I have 3 different tables:

Subscriptions: in this I made an IsActiveSubscription metric by status, which is 1 if it is active or 0 if it is not active.

Bookings: in this one I did the same for IsActiveBooking by status, which is 1 if it is active and 0 if it is not active.

Vehicles: which are active vehicles with a metric that is IsFreeOrUnpublished, which is 1 if active and 0 if not.

Now I need to be able to count how many vehicles have 1 regardless of whether it is booking, subscription or active vehicle, these are related by the license plate and I need it to take into account the calendar that was created as a table within the BI.

1 ACCEPTED SOLUTION
rajendraongole1
Super User
Super User

Hi @Syndicate_Admin -create a measure that checks the status of vehicles across the three tables (Subscriptions, Bookings, and Vehicles) and counts how many vehicles have at least one active status (either active subscription, active booking, or are free/unpublished). 

 

Create a  measure checks if the subscription status is active

IsActiveSubscription =
IF (
SELECTEDVALUE(Subscriptions[Status]) = "Active",
1,
0
)

 

This measure checks if the booking status is active

IsActiveBooking =
IF (
SELECTEDVALUE(Bookings[Status]) = "Active",
1,
0
)

 

measure checks if the vehicle status is active or free/unpublished

IsFreeOrUnpublished =
IF (
SELECTEDVALUE(Vehicles[Status]) = "Active" || SELECTEDVALUE(Vehicles[Status]) = "Free/Unpublished",
1,
0
)

 

create another measure counts vehicles where any of the three measures return 1.

CountActiveVehicles =
CALCULATE (
COUNTROWS ( Vehicles ),
FILTER (
Vehicles,
[IsFreeOrUnpublished] = 1 ||
CALCULATE ( [IsActiveSubscription], ALLEXCEPT(Subscriptions, Subscriptions[License Plate]) ) = 1 ||
CALCULATE ( [IsActiveBooking], ALLEXCEPT(Bookings, Bookings[License Plate]) ) = 1
)
)

 

Hope it helps

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

1 REPLY 1
rajendraongole1
Super User
Super User

Hi @Syndicate_Admin -create a measure that checks the status of vehicles across the three tables (Subscriptions, Bookings, and Vehicles) and counts how many vehicles have at least one active status (either active subscription, active booking, or are free/unpublished). 

 

Create a  measure checks if the subscription status is active

IsActiveSubscription =
IF (
SELECTEDVALUE(Subscriptions[Status]) = "Active",
1,
0
)

 

This measure checks if the booking status is active

IsActiveBooking =
IF (
SELECTEDVALUE(Bookings[Status]) = "Active",
1,
0
)

 

measure checks if the vehicle status is active or free/unpublished

IsFreeOrUnpublished =
IF (
SELECTEDVALUE(Vehicles[Status]) = "Active" || SELECTEDVALUE(Vehicles[Status]) = "Free/Unpublished",
1,
0
)

 

create another measure counts vehicles where any of the three measures return 1.

CountActiveVehicles =
CALCULATE (
COUNTROWS ( Vehicles ),
FILTER (
Vehicles,
[IsFreeOrUnpublished] = 1 ||
CALCULATE ( [IsActiveSubscription], ALLEXCEPT(Subscriptions, Subscriptions[License Plate]) ) = 1 ||
CALCULATE ( [IsActiveBooking], ALLEXCEPT(Bookings, Bookings[License Plate]) ) = 1
)
)

 

Hope it helps

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.