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.
Hello everyone! I'm struggling to solve a problem with a measure.
I'm using the wonderful resource of SWITCH + SELECTEDVALUE, but what happens when I need to perform a division, say, GMV/Orders. In the following case: ATV=GMV/Orders.
Solved! Go to Solution.
Hi @Anonymous ,
You need another Measure to calculate the value of GMV/Orders, then use it in current Measure .
ATV =
VAR GMV_ =
CALCULATE ( [GMV], ALL ( All_Data ) ) //[GMV] is a measure that sum the value of GMV
VAR Orders_ =
CALCULATE ( [Orders], ALL ( All_Data ) ) //[Orders] is a measure that sum the value of Orders
RETURN
IF ( SELECTEDVALUE ( All_Data[Grouping.1] ) = "ATV", GMV_ / Orders_, BLANK () )
division =
VAR MySelection =
SELECTEDVALUE ( 'De-para'[Grouping] )
RETURN
SWITCH (
TRUE (),
MySelection = "GMV", [GMV] / 1000000, //[GMV] is a measure that sum the value of GMV
MySelection = "Orders", [Orders], //[Orders] is a measure that sum the value of Orders
MySelection = "ATV", [ATV]
)
Then, the result should look like this.
Also, attached the pbix file as reference.
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!
Best Regards,
Community Support Team _ Caiyun
Hi @Anonymous ,
You need another Measure to calculate the value of GMV/Orders, then use it in current Measure .
ATV =
VAR GMV_ =
CALCULATE ( [GMV], ALL ( All_Data ) ) //[GMV] is a measure that sum the value of GMV
VAR Orders_ =
CALCULATE ( [Orders], ALL ( All_Data ) ) //[Orders] is a measure that sum the value of Orders
RETURN
IF ( SELECTEDVALUE ( All_Data[Grouping.1] ) = "ATV", GMV_ / Orders_, BLANK () )
division =
VAR MySelection =
SELECTEDVALUE ( 'De-para'[Grouping] )
RETURN
SWITCH (
TRUE (),
MySelection = "GMV", [GMV] / 1000000, //[GMV] is a measure that sum the value of GMV
MySelection = "Orders", [Orders], //[Orders] is a measure that sum the value of Orders
MySelection = "ATV", [ATV]
)
Then, the result should look like this.
Also, attached the pbix file as reference.
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!
Best Regards,
Community Support Team _ Caiyun
I don't quite understand the question. What are you expecting to happen when you "perform a division"? How is this division related to your switch measure?
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
24 | |
9 | |
7 | |
6 | |
6 |
User | Count |
---|---|
29 | |
11 | |
11 | |
10 | |
6 |