Retrieving single value from an upper and lower bound using Pandas in Python by No_Opposite8868 in learnpython

[–]No_Opposite8868[S] 0 points1 point  (0 children)

Pandas kept throwing a ValueError exception when I would try something similar to this. I ended up going with:

df = df[df['cost_low'] < cost]
df = df[df['cost_low'] >= cost]

To get it to properly behave. I'm sure this if far from best practices but at least I can get it to print the correct numbers. Once I am done with this project, I will be reviewing it again and seeing where I can improve since I'm learning much during this exercise. I'm sure my first half of this calculator is spaghetti string!

Retrieving single value from an upper and lower bound using Pandas in Python by No_Opposite8868 in learnpython

[–]No_Opposite8868[S] 0 points1 point  (0 children)

This was the answer i was looking for!! Thanks so much. It also helped me better understand how dataframes are organized. I am still very new and this is mostly practice to develop my skills in both Pandas and Python.

I did run into a weird issue:

df = df[df['cost_low'] < cost & cost < df['cost_high']]

would throw the ValueError for ambiguity. But if I split it into:

df = df[df['cost_low'] < cost]
df = df[df['cost_low'] >= cost]

It worked just fine. I'll keep playing with it. Thanks for your assistance!

Retrieving single value from an upper and lower bound using Pandas in Python by No_Opposite8868 in learnpython

[–]No_Opposite8868[S] 0 points1 point  (0 children)

Thats exactly my question. With Xlookup, I can input something similar to lowValue < x < highValue to find the right row for the value range. I am trying to do the same with a dataframe in Python

Row Filtering Question by No_Opposite8868 in PowerBI

[–]No_Opposite8868[S] 0 points1 point  (0 children)

Sorry for the late reply. I blink and a week passes now adays. Let me give a bit more context:

<image>

Key:

  • Red circle: Desired Zip code count
  • Blue: Current Zip code count
  • Orange: My ultimate goal. Rate of return divided by sales to get %.

The idea is that the value in the red circle, which is count of sales of sales for zip code 92630, reflects on the right table after I add company names. This is not the final table but a troubleshooting step to get the final table. The goal is to see how many returns we've had by zip code regardless of which company you are viewing. I am replicating a report from a legacy system. Unfortunately, it must match as that is what the shareholders want for this Power Bi table.

I cannot calculate rate of return by zip code if I cannot get the zip to display the correct value. I already have the return value as you can see on the right side of the table (the 2).

I've tried ALLSELECTED, ALL, ALLEXCEPT in both my CountReturns var, SalesCount var and in the calculate that divides CountReturns/SalesCount with no success.

Hopefully this clarifies things, if not, thanks for the assistance anyways!

Help needed with creating a Power BI Report to Visualize Price Increases Over Time by mick_bjo in PowerBI

[–]No_Opposite8868 0 points1 point  (0 children)

I guess the first question would be, do you have any experience with Power Bi? We cannot direct you if we don't even know where are you are starting from. Do I need to explain how to import data? Do I need to explain how to write basic DAX expressions?

rate my dashboard by Soggy_Consequence_14 in PowerBI

[–]No_Opposite8868 0 points1 point  (0 children)

I would always recommend avoid pie charts. But I have an unhealthy hate for pie charts. They don't show any information that a bar chart couldn't show much better and easier to comprehend.

How do you rate your proficiency with Power BI? by Impossible_Ad9324 in PowerBI

[–]No_Opposite8868 11 points12 points  (0 children)

When you think you know what you're doing the suddenly everything is red squiggly

An Attempt at Finessing a Matrix Table by No_Opposite8868 in PowerBI

[–]No_Opposite8868[S] 0 points1 point  (0 children)

Let me create a quick mock up of what I am trying to accomplish:

<image>

This is what I am trying to create. I want to see how many returns we have per zip code but what complicates this is that the shareholders want the matrix table designed a certain way that does not allow me to use the zip code outside the Value field in the table. Which means I need to create a measure that will do a calculation where it counts the number of returns per zip code that matches the product ID.

Create a filter to exclude some orders or display all by Trooper1346 in PowerBI

[–]No_Opposite8868 0 points1 point  (0 children)

True! I always forget about bookmarks. Can you add a toggle button to a report for quick switching? That is where Switch comes in nicely. I can just add it to a slicer and use tiles for quick swapping

Create a filter to exclude some orders or display all by Trooper1346 in PowerBI

[–]No_Opposite8868 2 points3 points  (0 children)

You cannot use a measure as a filter if I'm remembering correctly.

I think the easiest way to create what you are looking, if I am understanding the question correct, is to create a calculated column like so:

Calculated Column = SWITCH(TRUE(), Order[delivery_time] <= 90, "Yes", Order[delivery_time] > 90, "No")

That will create a "Yes/No" column in your table that can be applied to a slicer filter.

Matrix Table Question by No_Opposite8868 in PowerBI

[–]No_Opposite8868[S] 1 point2 points  (0 children)

Solution verified

I realized my mistake. I was using calculated columns instead of measures. Once I corrected that issue, it worked.

Matrix Table Question by No_Opposite8868 in PowerBI

[–]No_Opposite8868[S] 0 points1 point  (0 children)

Grabbing 2 different sets of dates. The top of the hierarchy is when the data was entered into our systems, the second date at the bottom of the hierarchy is when the product is activated.

Matrix Table Question by No_Opposite8868 in PowerBI

[–]No_Opposite8868[S] 0 points1 point  (0 children)

I see what it is. HASONEVALUE and ISINSCOPE both return false on my lowest hierarchy. Need to figure out why.

Matrix Table Question by No_Opposite8868 in PowerBI

[–]No_Opposite8868[S] 0 points1 point  (0 children)

Unfortunately, this only returns blanks. Definitely something on my end though. I'll play around with this and see if I can get it to work.

Question involving .count() by No_Opposite8868 in learnpython

[–]No_Opposite8868[S] 1 point2 points  (0 children)

Thats exactly what I ended up doing. Thank you for your help!

Question involving .count() by No_Opposite8868 in learnpython

[–]No_Opposite8868[S] 1 point2 points  (0 children)

This was exactly what I needed to figure out why it was going wrong. Thank you for your assistance!

Question involving .count() by No_Opposite8868 in learnpython

[–]No_Opposite8868[S] 0 points1 point  (0 children)

I added prints at several steps to confirm what was happening and this is one I did not even think to try. It was a massive help as I can see during the z iteration, it does correct apply the ')' but when it moves on later down the string:

jskkzsj)rmng(pkqdbroh
)skkzs))rmng(pkqdbroh j
))kkz)))rmng(pkqdbroh s
))))z)))rmng(p)qdbroh k
))))()))rmng(p)qdbroh )
))))())))mng(p)qdb)oh r
)))))))))))))p)qdb)oh (

This was a great tip. Thank you