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
Hello need help with a formula.
I am trying to create a dax formula based off the below data.
The formula should say
if the Sum/Count of the load number in Jan is
less than 3 = "75.00"
greater than or equal to 3 = "100.00"
greater than or equal to 4 = "125.00"
greater than 6 = "225.00"
other wise Null.
So Jan should give me a sum of 4 Loads and a fee of 125.00
Feb would give me a sum of 2 loads and a fee of 75.00 etc.
Solved! Go to Solution.
try:
Measure =
VAR _Count=COUNTROWS('Table')
RETURN
SWITCH(TRUE(),
_Count > 9, 300,
_Count >= 6, 200,
_Count >= 3 ,100,
_Count = 2, 75,
50)
Proud to be a Super User!
Paul on Linkedin.
@Anonymous
pls try this
Measure =
VAR _count=COUNTROWS('Table')
return SWITCH(TRUE(),_count<3,75,_count=3,100,_count=4,125,_count>6,225)
Proud to be a Super User!
Hello this is perfect How could I add a between in the formula ? for volume that is between 3 to 5 would equal 300
@Anonymous
this logic is in conflict with your first one which is equal to 4 = "125.00"
pls clarity the whole logics or you can try to modify the measure like below.
Measure =
VAR _count=COUNTROWS('Table')
return SWITCH(TRUE(),_count<3,75,_count=3,100,_count<5,300,_count>6,225)
Proud to be a Super User!
So For instance here is a new logic.
if count is equal to 1 = 50
if count is equal to 2 = 75
if count is between 3 to 5 = 100
if count is between 6 to 8 = 200
if count is greater than 9 = 300
how could I write out the between version.
try:
Measure =
VAR _Count=COUNTROWS('Table')
RETURN
SWITCH(TRUE(),
_Count > 9, 300,
_Count >= 6, 200,
_Count >= 3 ,100,
_Count = 2, 75,
50)
Proud to be a Super User!
Paul on Linkedin.
@ryan_mayu, I did have a solution that has now been deleted given the simplicity of yours 😂!!
Love your work mate!
If I have posted a response that resolves your question, please accept it as a solution to formally close the post.
Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!
Want to connect?www.linkedin.com/in/theoconias
Thank you
Proud to be a Super User!
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 40 | |
| 35 | |
| 34 | |
| 31 | |
| 28 |
| User | Count |
|---|---|
| 136 | |
| 102 | |
| 68 | |
| 66 | |
| 58 |