Forum Discussion
Multiple taxonomy in same table
Dear friends,
I am trying to find a solution to my report. The report fetches the data from a Wordpress database, where the posts are assigned to taxonomy (category, tag, series) in a separate table. So in the relationship table against a postid, the associated taxonomy ids are linked.
A post (id) can be associated to one or more category, series and tag (ids)
e.g table below
| Title | Taxonomy | Value |
| Ram meets Sita | category | Mythology |
| Ram meets Sita | Series | Ramayana |
| Shivaji kills Azal | category | Historical |
| Shivaji kills Azal | Series | Maratha Kings |
| Theogony: Clash of the Titans | category | Mythology |
| Theogony: Clash of the Titans | Series | Theogony |
| Jalianwalah Bagh massacre | category | Historical |
| Jalianwalah Bagh massacre | Series | Independence |
Currently I am able to get only one taxonomy against the post in the basic table. I am trying to create a basic report that has the following structure and do the filtering.
| Title | Category | Series |
| Ram meets Sita | Mythology | Ramayana |
| Shivaji kills Azal | Historical | Maratha Kings |
| Theogony: Clash of the Titans | Mythology | Theogony |
| Jalianwalah Bagh massacre | Historical | Independence |
Can someone help me in getting both category and series of a post in the single table?
Hi,
This M code works
let Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content], #"Pivoted Column" = Table.Pivot(Source, List.Distinct(Source[Taxonomy]), "Taxonomy", "Value") in #"Pivoted Column"Hope this helps.
- Anonymous2 years ago
Hi Anonymous ,
Here are the steps you can follow:
1. Create calculated table.
Table = SUMMARIZE('Table1','Table1'[Title], "category",CALCULATE(MAX('Table1'[Value]),TREATAS({"category"},'Table1'[Taxonomy])), "Series",CALCULATE(MAX('Table1'[Value]),TREATAS({"Series"},'Table1'[Taxonomy])))2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
2 Replies
- Ashish_MathurSuper User
Hi,
This M code works
let Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content], #"Pivoted Column" = Table.Pivot(Source, List.Distinct(Source[Taxonomy]), "Taxonomy", "Value") in #"Pivoted Column"Hope this helps.
- AnonymousNot applicable
Hi Anonymous ,
Here are the steps you can follow:
1. Create calculated table.
Table = SUMMARIZE('Table1','Table1'[Title], "category",CALCULATE(MAX('Table1'[Value]),TREATAS({"category"},'Table1'[Taxonomy])), "Series",CALCULATE(MAX('Table1'[Value]),TREATAS({"Series"},'Table1'[Taxonomy])))2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly