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.
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.
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))
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 @andy_pat
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
)
)
Hope it resolves your issue? Did I answer your question? Mark my post as a solution! Appreciate your Kudos, Press the thumbs up button!! Linkedin Profile |
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
97 | |
85 | |
67 | |
59 |
User | Count |
---|---|
150 | |
120 | |
99 | |
87 | |
68 |