Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Im working in power bi.
I have a fact.orders table with OrderID | ShipmentDate | PaymentDate | IsNewPayment | IsNewShipment
I also have a calendar table with inactive relationships to ShipmentDate and PaymentDate.
I have a calculation group to swap between using the shipment or payment date.
I now need to build some logic so that when the calculationgrouphas picked PaymentDate, the categorical field used in a visual for IsNew is also using Payment date.
Basically i want to "category" of IsNew to swap from IsNew Payment to IsNew Shipment when the calculation group is swapped on the relationship for calculation date type.
I've tried with field parameters, but couldn't find a way to get it to work, even when added logic like FILTER and ALL to the calculation group.
Any suggestions?
Link to sample dataset: https://drive.google.com/file/d/1l3NBi8fhiWAFxExF0D_nqyrFD6AfBFUa/view?usp=drive_link
https://drive.google.com/file/d/1l3NBi8fhiWAFxExF0D_nqyrFD6AfBFUa/view?usp=drive_link
Guess it wasn't super clear since you couldn't open the model.
IsNew Payment/Shipment are categorical fields, they contain text values such as (New, Returning, Reactivated).
I want to use it as a cateogrical field inside say a matrix visual on a row low. So it cannot be a measure, it has to be a dimension. That's why i was trying with field parameters
@v-yohua-msft in case you didn't see my reply as it looks like it wasn't linked to you 🙂
Hi, @AlexaderMilland
Sorry to restore you so late. After my attempts, it seems that using the calculation group cannot achieve the results you want, and it is also possible that my knowledge is too shallow. I've tried using a calculated column to determine the selected slicer contents, but the calculated column can't read the slicer value, and I can't put it in the Row of the matrix using a measure.
If you want to use parameters, you just need to create a parameter, check PaymentDate and ShipmentDate.
Then put the created parameter column in the Row of the matrix view.
When select slicer, the martix will change:
How to Get Your Question Answered Quickly
Best Regards
Yongkang Hua
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Ideally what im looking at is a solution that with just 1 click
1) enables the calculation group to swap the relationship between the calendar table and the fact table
2) swaps the caterogical field inside the visual from IsNew Payment to IsNew Shipment, probably through the use of a field parameter.
Could you post the PBIX file since it looks like you left out some steps.
The photo with the field parameters is based on the date field, while the slicer in last photo is based on the IsNew category?
Hi, @AlexaderMilland
I'm sorry I can't open your sample file link, I created the sample data:
Orders Table
Calendar Table
Relationship
Create calculated group:
Then put this group in Slicer view and create a new measure, try the following DAX:
IsNewDynamic =
SWITCH(
SELECTEDVALUE('Calculation group'[Calculation group column]),
"ShipmentDate", CALCULATE(SUM('Orders'[IsNewShipment]), USERELATIONSHIP('Calendar'[Date], 'Orders'[ShipmentDate])),
"PaymentDate", CALCULATE(SUM('Orders'[IsNewPayment]), USERELATIONSHIP('Calendar'[Date], 'Orders'[PaymentDate]))
)
Put this measure in visual. When you click on the slicer, the date is switched, here is my preview:
How to Get Your Question Answered Quickly
Best Regards
Yongkang Hua
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@v-yohua-msft This is what Exactly i was trying to suggest! Welldone!
Proud to be a Super User!
The above solution does not work?