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!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hi!!
I was wondering if there was a way to rewrite this code or add something in to make it work:
I have a few tables with the following info for different products:
I have another table that is:
The relationship between the different product tables and Month table is connected via End Date
So anyways, I wanted to use the following formula to bring in the Duration for each product into this month table so I can figure out the overall Average and Mean per month (for my visuals)
=SELECTCOLUMNS(RELATEDTABLE(Product 1), "Product 1", Product 1[Duration])
This worked for most of the products, but some products have lots that ended on the same day, so DAX is saying "A table of multiple values was supplied where a single value was expected".
Is there a workaround for this?
So far I have tried:
If anyone has any ideas for how I can find this that would be really helpful!!!!!
Thank you!
P.S. I have created a very basic example file to help show what I am trying to say/do! Here is a link to a Google Drive file upload, please let me know if there are any issues downloading:
https://drive.google.com/file/d/1t0gakGk0e9d1C8BSqaR5xH1hTRnqZUfi/view?usp=sharing
Note: in this example file, each Product table is the exact same. In my real file, the product tables have different # and names of columns so I can't just append them all together 😞
Solved! Go to Solution.
I have found a workaround to solve my problem (FINALLY!!!) 🙂 🙂 🙂
So:
IF(AND(Index >=1, Index <= 100), DATEDIFF(Start, End), IF(AND(Index >= 101, Index <= 200), DATEDIFF(Start, End), IF(AND(Index >= 201, Index <= 300), DATEDIFF(Start, End), IF(AND(Index >= 301, Index <= 400), DATEDIFF(Start, End), IF(AND(Index >= 401, Index <= 500), DATEDIFF(Start, End), BLANK)))))
IF(AND(Index >= 1, Index <= 100), End Date, IF(AND(Index >= 101, Index <= 200), End Date, IF(AND(Index >= 201, Index <= 300), End Date, IF(AND(Index >= 301, Index <= 400), End Date, IF(AND(Index >= 401, Index <= 500), End Date, BLANK)
and voila! *chef kiss* a rolling median. (also have a graph for average but same thing only different!)
I have found a workaround to solve my problem (FINALLY!!!) 🙂 🙂 🙂
So:
IF(AND(Index >=1, Index <= 100), DATEDIFF(Start, End), IF(AND(Index >= 101, Index <= 200), DATEDIFF(Start, End), IF(AND(Index >= 201, Index <= 300), DATEDIFF(Start, End), IF(AND(Index >= 301, Index <= 400), DATEDIFF(Start, End), IF(AND(Index >= 401, Index <= 500), DATEDIFF(Start, End), BLANK)))))
IF(AND(Index >= 1, Index <= 100), End Date, IF(AND(Index >= 101, Index <= 200), End Date, IF(AND(Index >= 201, Index <= 300), End Date, IF(AND(Index >= 301, Index <= 400), End Date, IF(AND(Index >= 401, Index <= 500), End Date, BLANK)
and voila! *chef kiss* a rolling median. (also have a graph for average but same thing only different!)
HI @sy898661 ,
You can't create a dynamic calculated column/table based on current row contents or filters, it will return static value based on whole table.
Regards,
Xiaoxin Sheng