Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Anonymous
Not applicable

Create a column based on a number (DAX)

Hello Guys!

 

I need to create a column in DAX based in a number.

Sample:

 

Client     |  Number of Portions

Client 1  |  43

 

I need to create a column based in the Number of Portions. 

What I need:

 

Number of Portions DAX

1

2

3

...

43

 

After this i will need to use that value of row to some financial equasions, like NPV.

I will use a filter of client to mainten just one client to the page.

I have tryed Summarize with Addcoluns without sucess, after tryed the GENERATESERIES but for some reason they dont make the column.

 

Very Thanks in advance

1 ACCEPTED SOLUTION

I'm not sure I completely understand what you want..  but if you want to use GENERATESERIES,  the result is a table with one column of numbers.  If you have another table with a client name for example, you can build a 3rd table using GENERATE or CROSSJOIN.

Here's a small example

TableNumbers = GENERATESERIES(1, 50,1)

TableClient = DATATABLE("Client", STRING, {{ "fred"}})

TableClientsNumbers = CROSSJOIN(TableClient ,  TableNumbers )

This will produce a table with fred, 1    fred,2 and so on.

I think your scenario is more complex but this might get you started.

View solution in original post

4 REPLIES 4
HotChilli
Super User
Super User

Show us your code using GENERATESERIES, please

Anonymous
Not applicable

Hello @HotChilli

 

The code I used:

 

Measure = GENERATESERIES(1;AVERAGE(Contratos[Qtd. Parcelas]);1)

 

The AVERAGE(Contratos[Qtd. Parcelas]) bring me the number of Portions the Client Have.

 

I tryed to put this in a table using summarize:

 

Table = SUMMARIZE(Contratos;Contratos[Nº. Contrato];"Parcelas";[Measure])

 

Thax again!!

I'm not sure I completely understand what you want..  but if you want to use GENERATESERIES,  the result is a table with one column of numbers.  If you have another table with a client name for example, you can build a 3rd table using GENERATE or CROSSJOIN.

Here's a small example

TableNumbers = GENERATESERIES(1, 50,1)

TableClient = DATATABLE("Client", STRING, {{ "fred"}})

TableClientsNumbers = CROSSJOIN(TableClient ,  TableNumbers )

This will produce a table with fred, 1    fred,2 and so on.

I think your scenario is more complex but this might get you started.

Anonymous
Not applicable

Thanks for the Reply!

 

It worked after some ajusts but help a lot.

 

Cheers,

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.