cancel
Showing results for
Did you mean:
Resolver I

## 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.

1 ACCEPTED SOLUTION
Super User

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.

4 REPLIES 4
Super User

Resolver I

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!!

Super User

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.

Resolver I

It worked after some ajusts but help a lot.

Cheers,

Announcements

#### Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

#### Charticulator Design Challenge

Put your data visualization and design skills to the test! This exciting challenge is happening now through May 31st!

#### What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.