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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
34583458hhdnsk
Frequent Visitor

New Column Creation Help

My data is structured like so: 

34583458hhdnsk_0-1747358516516.png

 

34583458hhdnsk_1-1747358516395.png

 

In the Data column I have different labels such as PV, Number of Cards, etc. I would like to create a new data field titled: Spend per Card where it calculates number of cards/pv for each row. How do you do this?

I wanted to follow these steps:

  1. Open Power Query Editor (Power BI: Home > Transform data).
  2. Identify columns: Ensure you have columns like Date, Data, and Value.
  3. Select the "Data" column.
  4. Go to Transform > Pivot Column.
  5. In the dialog:

Values Column = your numeric column (e.g., "Value").

Use default aggregation (Don’t Aggregate if available).

6. After pivoting, you'll get new columns like PV and Number of Cards.

7. Click Add Column > Custom Column and enter:

Spend per Card = [PV] / [Number of Cards]

8. Click Close & Apply.

But it did not work. I created Spend Per Card column like so but all values are null. (PV and Number of cards have values aside from null)

34583458hhdnsk_2-1747358546945.png

Any help on the above?

 

1 ACCEPTED SOLUTION

@34583458hhdnsk 

you can try to create a measure for this

Measure = DIVIDE(sumx(FILTER('Table','Table'[Data]="PV"),'Table'[Number(USD)]),sumx(FILTER('Table','Table'[Data]="Number of Cards"),'Table'[Number(USD)]))
 
11.png
for JPY you can create a similar measure to get the speed
 
pls see the attachment below

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

12 REPLIES 12
v-priyankata
Community Support
Community Support

Hi @34583458hhdnsk 
I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.
Thank you.

v-priyankata
Community Support
Community Support

Hi @34583458hhdnsk 
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you

v-priyankata
Community Support
Community Support

Hi @34583458hhdnsk 

Thanks @ryan_mayu @maruthisp for your inputs, @34583458hhdnsk May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

Thank you.

maruthisp
Super User
Super User

Hi @34583458hhdnsk ,

As I am not comfortable with Power Query , why don't you try DAX expression to do the same?
Hoping your data model has 2 measures

PV = CALCULATE( SUM( Table[Value] ), Table[Data] = "PV" )

NumberOfCards = CALCULATE( SUM( Table[Value] ), Table[Data] = "Number of Cards" )

Create a 3 measure:
Spend per Card =
DIVIDE(
[PV],
[NumberOfCards],
BLANK() // or 0
)


Please let me know if you have further questions.

If this reply helped solve your problem, please consider clicking "Accept as Solution" so others can benefit too. And if you found it useful, a quick "Kudos" is always appreciated, thanks! 

 

Best Regards, 

Maruthi 

LinkedIn - http://www.linkedin.com/in/maruthi-siva-prasad/ 

X            -  Maruthi Siva Prasad - (@MaruthiSP) / X




 

 

ryan_mayu
Super User
Super User

@34583458hhdnsk 

your screenshot is too small. could you pls paste your sample data here and also provide the expected output?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@ryan_mayu Here is some sample data:

Table I have

AccountTimeNumber (JPY)Data
123Q150PV
123Q260PV
123Q110Number of Cards
123Q220Number of Cards

Table I want:

AccountTimeNumber (JPY)Data
123Q150PV
123Q260PV
123Q110Number of Cards
123Q220Number of Cards
123Q15 (50/10)Spend per card
123Q23 (60/20)Spend per card

@34583458hhdnsk 

in PQ,

1. select the Data column and pivot column

11.png

2. create speed column

12.png

3. select the last 3 columns and unpivot column

 

13.png

 

 

4. renname column name

14.png

 

pls see the attachment below





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




When I pivot column it looks like this and i think this is the problem:

AccountTimePVNumber of Cards
123Q150null
123Q260null
123Q1null10
123Q2null20

 

@ryan_mayu FYI my full table looks something like this:

AccountTimeProductNumber (USD)Number (JPY)DataSub-DataVolumeSub-Volume
123Q1Credit550PVAFTInternationalNA
123Q2Credit660PVWithout AFTDomesticOn-Us
123Q2Credit440PVWithout AFTDomesticOff-Us
123Q1Credit110Number of CardsNANANA
123Q2Debit220Number of CardsNANANA

 

I want spend per card to be total pv/number of cards - i am planning to create a slicer based on account and product and show a graph of spend per card according to the slicer

what's the expected output based on this sample data?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




34583458hhdnsk_1-1747381175475.png

 

@34583458hhdnsk 

you can try to create a measure for this

Measure = DIVIDE(sumx(FILTER('Table','Table'[Data]="PV"),'Table'[Number(USD)]),sumx(FILTER('Table','Table'[Data]="Number of Cards"),'Table'[Number(USD)]))
 
11.png
for JPY you can create a similar measure to get the speed
 
pls see the attachment below

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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