Forum Discussion
Spend per card calculation
- 1 year ago
Hi 34583458hhdnsk ,
You can do it by using this DAX measure spend per card = DIVIDE([PV], [Number of Cards]), but before adding the custom column, confirm that PV and Number of cards columns are visible and populated in the preview after the step pivot, if not, the pivot step needs to be corrected.
Thanks and regards,
Chaithra.
- Open Power Query Editor (Power BI: Home > Transform data).
- Identify columns: Ensure you have columns like Date, Data, and Value.
- Select the "Data" column.
- Go to Transform > Pivot Column.
- 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.
It does 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)