tip
4 TopicsLooking forwad to get the result in table from two tables
input : Table1 Code A B C D Table2 Code Description A Name1 B Name2 C Name3 Name4 Name5 Name6 Result I am getting in table visualization Code Description A Name1 B Name2 C Name3 D Name4 Name5 Name6 Result I Need Code Description A Name1 B Name2 C Name3 DSolved390Views0likes1CommentFind columns from one table in another table
Hello, i'm trying to find columns of 1 table on a 2nd table, but i'm struggling because i can't seem to use distinct or values with text operators (2nd column can be slightly different, as you'll see), and i also was trying to use addcolumns and summarize in a variable but i don't know how to use it after on the Calculate's Filter. So what i pretend is to count table1\column1 in table2\column1, the detail is that : - it could not exist, as AA-00004 - it can exist exactly equal or with a variation on the string (AA-00001 with AA-00001 and AA-00001--1) What's the best / correct way to do this? Thanks in advanceSolved1.7KViews0likes9CommentsShow only one value for same Id else leave it blank
Hello, I have an issue on my report and i dont know how to do it, i have this table : IdRole NameRole 1 AA 2 AB 3 AC And this second table : IdUser IdRole 1 1 1 2 2 1 3 3 And i have my last table for example with somes informations : IdUser Date Point NameRole 1 03/05/2021 500 AA 1 01/05/2021 500 AA 2 03/03/2020 800 Blank 3 17/02/2020 1000 Blank I want to have this last colum as a result, The User have many role but the only Role that im interested is to know if he have "AA" role else leave it blank. Im in DirectQuery if someone can help me please. Thank you for the futur answer.Solved1.2KViews0likes1CommentSharing: How to create test data using DAX!
Hi, In this article, I will show how to generate sample data and how to add this to your data model. The result is a sales table and related dimensions: This is the code to generate the sales table: Sales = VAR _tbl = SELECTCOLUMNS ( CROSSJOIN ( ROW ( "test", DATE ( 2020, 10, 3 ) ), GENERATESERIES ( 1, 60, 1 ) ), "StartDate", [test], "Increment", [Value] ) VAR _dates = ADDCOLUMNS ( _tbl, "NewDate", [StartDate] + [Increment] ) RETURN GENERATE ( SELECTCOLUMNS ( { "Vendor 1", "Vendor 2", "Vendor 3", "Vendor 4", "Vendor 5" }, "Vendor", [Value] ), SELECTCOLUMNS ( ADDCOLUMNS ( CROSSJOIN ( _dates, GENERATESERIES ( 1, 10, 1 ) ), "open_time", [NewDate] + NORM.INV ( RAND (), 0.5 + ( [Increment] / 100 ), 0.08 ), "PRODUCT", CONVERT ( UNICHAR ( RANDBETWEEN ( 65, 90 ) ), STRING ) & CONVERT ( UNICHAR ( RANDBETWEEN ( 65, 90 ) ), STRING ) & CONVERT ( UNICHAR ( RANDBETWEEN ( 65, 90 ) ), STRING ), "sales_amount", NORM.INV ( RAND (), [Value], [Value] / 10 ) ), "sales_date_time", [open_time], "PRODUCT", [PRODUCT], "sales_amount", [sales_amount] ) ) You can add the above code by navigating to the ribbon in Power BI, select 'Modelling' to then select 'New Table'. Paste the above code in the editor. Explanation In the next part, I will break down the working of the code. First, we generate a series of dates: We started with a default date and added an incremental column, that column sets the number of days that we will add to the default data. Next is adding vendors: SELECTCOLUMNS ( { "Vendor 1", "Vendor 2", "Vendor 3", "Vendor 4", "Vendor 5" }, "Vendor", [Value] For each vendor, all the dates (generated above) are added and a timestamp is added: SELECTCOLUMNS ( ADDCOLUMNS ( CROSSJOIN ( _dates, GENERATESERIES ( 1, 10, 1 ) ), "open_time", [NewDate] + NORM.INV ( RAND (), 0.5 + ( [Increment] / 100 ), 0.08 ), A product is added by randomly selected characters from the UNICHAR array: "PRODUCT", CONVERT ( UNICHAR ( RANDBETWEEN ( 65, 90 ) ), STRING ) & CONVERT ( UNICHAR ( RANDBETWEEN ( 65, 90 ) ), STRING ) & CONVERT ( UNICHAR ( RANDBETWEEN ( 65, 90 ) ), STRING ), A sales amount is added: "sales_amount", NORM.INV ( RAND (), [Value], [Value] / 10 ) Finally, the required columns are added: "sales_date_time", [open_time], "PRODUCT", [PRODUCT], "sales_amount", [sales_amount] ) With the above steps, we have created the fact table. With that table in place we can add the dimension tables by simply adding a table with DAX like below: dimProducts = VALUES(Sales[PRODUCT]) As a final step, we add the relationships in the data model. That is hopefully on familiar grounds. You can have fun with generating data and creating art from it as well 🙂 , see below: The above image is from a response that I wrote when helping out somebody with a DAX challenge. Hope that you find it useful. An example is attached. Kind regards, Steve.2.5KViews1like0Comments