Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I am trying to build a dynamic measure with a toggle as below: Its is likely simple for pros, but can't seem to figure out the DAX way.
See PBIX attached - https://ufile.io/n4nji186
Current measure:
sum Dynamic =
VAR toggle =
SELECTEDVALUE ( 'Select Div'[Val],0 )
return( CALCULATE(
DIVIDE(SUM('Table'[sale]), 0.5)
)
)
Required measure:
if toggle = Divide:
when category in A, C - divide sum(sale) by 1 (in other words don't divide, just keep the numerator as is)
when category = B = divide sum(sale) by 0.5
If toggle = No_Divide :
Do nothing and calculate the sum(sale) without any division.
Thanks in advance!
Andy
Solved! Go to Solution.
@Anonymous ,
As a new measure
new measure =
Switch( True() ,
max(Table[category]) in {"A","C"} , sum(sale)/1,
max(Table[category]) in {"B"} , sum(sale)/0.5,
sum(sale))
As a new colum
new column =
Switch( True() ,
(Table[category]) in {"A","C"} , (sale)/1,
(Table[category]) in {"B"} , (sale)/0.5,
(sale))
@Anonymous ,
As a new measure
new measure =
Switch( True() ,
max(Table[category]) in {"A","C"} , sum(sale)/1,
max(Table[category]) in {"B"} , sum(sale)/0.5,
sum(sale))
As a new colum
new column =
Switch( True() ,
(Table[category]) in {"A","C"} , (sale)/1,
(Table[category]) in {"B"} , (sale)/0.5,
(sale))
Hello I would like to make a dynamic division of the average daily sales, I have a summary table by the days of each month. But I need you to change the division of the total amount of sales by the number of days of the month. For example 1
Total sales September = 100
Days of the month of September = 30
Result 100/30
example 2
Total sales October = 100
Days of the month of September = 31
result 100/31
Thank you.
Hi @Anonymous
IF(('Table'[toggle] = "Divide" && 'Table'[category] in {"A","C"}) || 'Table'[toggle] = "No_Divide", SUM('Table'[sale]),
IF('Table'[toggle] = "Divide" && 'Table'[category] = "B", DIVIDE(SUM('Table'[sale]), 0.5),0
)
)
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 59 | |
| 46 | |
| 42 | |
| 24 | |
| 18 |
| User | Count |
|---|---|
| 193 | |
| 124 | |
| 101 | |
| 67 | |
| 49 |